You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
returnfetch(basePath+localVarFetchArgs.url,localVarFetchArgs.options).then((response)=>{if(response.status>=200&&response.status<300){returnresponse.json();// Throws "Uncaught (in promise) SyntaxError: Unexpected token % in JSON at position 0"}else{throwresponse;}});
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();
The text was updated successfully, but these errors were encountered:
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
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 theisResponseFile
flag. WhenisResponseFile
is true, return the response content as blob ->return response.blob();
The text was updated successfully, but these errors were encountered: