Skip to content

Commit

Permalink
[javascript] Fix no content-type error for empty responses (#1178)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
svix-lucho authored Jan 24, 2024
1 parent 9e1f06e commit f9f9e86
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions javascript/templates/api/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ export class {{classname}}ResponseProcessor {
public async {{nickname}}(response: ResponseContext): Promise<{{#returnType}}{{{returnType}}}{{/returnType}} {{^returnType}}void{{/returnType}}> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (contentType === undefined) {
throw new Error("Cannot parse content. No Content-Type defined. Body: " + await response.body.text());
}

{{#responses}}
if (isCodeInRange("{{code}}", response.httpStatusCode)) {
{{#dataType}}
Expand Down

0 comments on commit f9f9e86

Please sign in to comment.