Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can support "Get" command with request body ? #88

Open
dzhu622911 opened this issue Jan 7, 2016 · 4 comments
Open

Can support "Get" command with request body ? #88

dzhu622911 opened this issue Jan 7, 2016 · 4 comments

Comments

@dzhu622911
Copy link

I am using flask-restful-swagger in my restful app,
because my requirements have many parameters for different resources, so i want to put all of the params into request body of "Get" method (most of my app case is "Get" data).

i use curl to test my design, it works fine, just like:
curl -i -H "Content-Type: application/json" -d "{"param1":"value1", "param2":"value2"}" -X GET localhost:5000/api/v1/resource

but when i use swagger UI to test, it looks fine, with body type parameters in UI, but it can't send the request body to my restful service (Receive None from request.json).

I know maybe the "query" paramType is suit for me, but i don't want to use query, because it will make a very long and complex URL.

The another option is "header" paramType, that could be a good choice, but current code (swagger 1.2 implementation) can't support header, right ?

Is there any possible method can meet my requirements or i need modify the swagger code ?

@lukas-gitl
Copy link

Get does not allow post parameters. So if you are using http GET you can not use a body.

@niall-byrne
Copy link
Collaborator

I would have to recommend using POST, especially if you really want to send JSON, as that's the use case it's designed for.

@dzhu622911
Copy link
Author

I have used POST already, so it seems POST is the only choice

@niall-byrne
Copy link
Collaborator

Once we are able to start implementing newer features like the "header" paramType, you'll have more options- thanks for flagging this as an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants