feat: handling x-www-form-urlencoded #687
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #632
Description
Hello,
I discovered this project, and it looked awesome, so I used it in order to replace my custom API call handling functions. It works perfectly for application/json.
However, my API implements OIDC, and thus uses application/x-www-form-encoded instead of application/json.
When running, the generated code for those API routes was throwing error.
After some research, I found that this issue has already been reported, so I am proposing a fix for it.
How does it work?
Until now, x-www-form-encoded were handled the same way as multipart (in swagger_models/requests/swagger_request.dart).
I created a new parameter called isUrlencoded to dissociate these two cases, and used to it handle the right way specified here : https://hadrien-lejard.gitbook.io/chopper/requests#sending-application-x-www-form-urlencoded-data
Checklist
[x] I have performed a self-review of my code
[x] My code follows the code style of this project
[x] I have commented my code, particularly in hard-to-understand areas
If you think this change may be interesting to add to swagger-dart-code-generator, I will be happy to improve the pull request based on received feedback and suggestions.
Best regards