-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Description
Description
Currently, swagger attempts to process file (application/octet-stream) response content as JSON. In particular, swagger calls response.json()
, which results in an error.
Swagger-codegen version
v2.4.0 - master.
Swagger declaration file content or url
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
if (response.status >= 200 && response.status < 300) {
return response.json(); // Throws "Uncaught (in promise) SyntaxError: Unexpected token % in JSON at position 0"
} else {
throw response;
}
});
Command line used for generation
java -jar ./other_modules/swagger/swagger-codegen-cli.jar generate -i http://localhost:8011/swagger/v1/swagger.json -l typescript-fetch -o ./other_modules/swagger/output
Steps to reproduce
Run swagger-codegen against an API that produces application/octet-stream
content.
Suggest a fix/enhancement
Modify the api.mustache
file for typescript-fetch as need be (make reference to typescript-angular module where support for file response types has already been added), using the isResponseFile
flag. When isResponseFile
is true, return the response content as blob -> return response.blob();
twosigmajab, charles-dr, anders0l and miderose
Metadata
Metadata
Assignees
Labels
No labels