buildUnmarshalCase builds an unmarshaling case clause for different content-types:
(typeDefinition ResponseTypeDefinition, caseAction string, contentType string)
| 268 | |
| 269 | // buildUnmarshalCase builds an unmarshaling case clause for different content-types: |
| 270 | func buildUnmarshalCase(typeDefinition ResponseTypeDefinition, caseAction string, contentType string) (caseKey string, caseClause string) { |
| 271 | caseKey = fmt.Sprintf("%s.%s.%s", prefixLeastSpecific, contentType, typeDefinition.ResponseName) |
| 272 | caseClauseKey := getConditionOfResponseName("rsp.StatusCode", typeDefinition.ResponseName) |
| 273 | contentTypeLiteral := StringToGoString(contentType) |
| 274 | caseClause = fmt.Sprintf("case strings.Contains(rsp.Header.Get(\"%s\"), %s) && %s:\n%s\n", "Content-Type", contentTypeLiteral, caseClauseKey, caseAction) |
| 275 | return caseKey, caseClause |
| 276 | } |
| 277 | |
| 278 | func buildUnmarshalCaseStrict(typeDefinition ResponseTypeDefinition, caseAction string, contentType string) (caseKey string, caseClause string) { |
| 279 | caseKey = fmt.Sprintf("%s.%s.%s", prefixLeastSpecific, contentType, typeDefinition.ResponseName) |
no test coverage detected