-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[typescript-angular2] Bug: Request Content-Type other than json not allowed #6588
Comments
@stoetti @keradus @sebastianhaas could you have a look at this issue?
|
cc @wing328 |
@macjohnny I think that's a bug that needs to be fix. It should not used only JSON-related MIME types. The correct logic should be checking If JSON-related MIME is found in |
this issue would be resolved by merging #6295 |
this issue was resolved with #6295 |
@macjohnny are you going to file another PR to fix the following as originally reported in this issue?
I don't think isJsonMime is used at the moment:
|
@wing328 the issue was resolved with the changes introduced in #6295. This is why in #6574 I removed the |
@wing328 btw are there already a release schedule for 2.3.0? |
Description
The changes in #6454 introduced setting the request content-type from the
consumes
property.However, the content type is limited to
json
-like mime types. Therefore the content-type is set to an empty string if we e.g. upload a file and haveand since
multipart/form-data
is not a json mime-type, this results in setting and empty string value.This in turn, results in an invalid content-type header being set, as explained e.g. here: angular/angular#11819
This breaks e.g. the PetStore.uploadFile() API in the petStore example:
swagger-codegen/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts
Line 204 in bd5b586
Swagger-codegen version
2.3.0
Swagger declaration file content or url
See the petstore example
swagger-codegen/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts
Line 633 in bd5b586
Command line used for generation
Steps to reproduce
Related issues/PRs
Maybe this is resolved with #6080
Suggest a fix/enhancement
Do not restrict the conten-type to json mime types.
Let angular detect the content-type automatically from the data.
The text was updated successfully, but these errors were encountered: