swagger-api / swagger-api/swagger-codegen

Problem with generated python client

Open
#12,086 0 comments 2 reactions 0 assignees View on GitHub

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)
Screenshots

I generated a client for python and I see a problem.
File: python-client-generated/python-client/swagger_client/rest.py

image_2023-03-10_132642555

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

image_2023-03-10_133206357

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.