swagger-api / swagger-api/swagger-codegen
Problem with generated python 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, especially the GET/HEAD handling around lines 150 and 206, and trace it back to the Swagger Codegen template that produces this file. Verify the generated client does not send a Content-Type header for GET or HEAD requests with no body, then regenerate or run the relevant client checks if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100