swagger-api / swagger-api/swagger-codegen

Problem with generated client

Open
#12,087 1 comment 0 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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.