Skip to content

Commit f9f9e86

Browse files
authored
[javascript] Fix no content-type error for empty responses (#1178)
In a previous PR #1160 I added an error message that is thrown before checking the response types, when no content type is defined. That is causing issues in some cases since there are cases in which the API returns no content type in the response (for example, when the response code is `202 Accepted`). Undoing that change for now. We need a better way to check for invalid content-type responses, but I want to get this fix out first.
1 parent 9e1f06e commit f9f9e86

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

javascript/templates/api/api.mustache

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ export class {{classname}}ResponseProcessor {
166166
public async {{nickname}}(response: ResponseContext): Promise<{{#returnType}}{{{returnType}}}{{/returnType}} {{^returnType}}void{{/returnType}}> {
167167
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
168168
169-
if (contentType === undefined) {
170-
throw new Error("Cannot parse content. No Content-Type defined. Body: " + await response.body.text());
171-
}
172-
173169
{{#responses}}
174170
if (isCodeInRange("{{code}}", response.httpStatusCode)) {
175171
{{#dataType}}

0 commit comments

Comments
 (0)