swagger-api / swagger-api/swagger-codegen
Problem with generated client
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Q&A (please complete the following information)
- OS: Ubuntu 22.0.4
- Browser: Chrome
- Version: 110.0.5481.177
- Method of installation: -
- Swagger-Editor version: https://editor.swagger.io or https://editor-next.swagger.io
- Swagger/OpenAPI version: Swagger 2.0
Screenshots
I generated a client for python and I see a problem.
File: python-client-generated/python-client/swagger_client/rest.py

GET methods may not work correctly if they check content-type.
The problem is on line 150. GET/HEAD requests should not have a content-type header since they do not have a request body.
Solution. Add line del headers['Content-Type'] after line 206

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with python-client-generated/python-client/swagger_client/rest.py and inspect the header handling around lines 150 and 206. Reproduce a GET or HEAD request that checks Content-Type, then verify that the generated client does not send that header when there is no request body.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100