GET request do not allow a body
See original GitHub issueQ&A (please complete the following information)
- OS: linux
- Browser: firefox
- Version: 67
- Method of installation: composer
- Swagger-UI version: 3.20.7
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Example Swagger/OpenAPI definition:
openapi: "3.0.0"
servers:
- url: https://myproject.development
paths:
/search-by-email:
get:
requestBody:
description: get info by email address
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
example: john.doe@gmail.com
Describe the bug you’re encountering
As far as i understand the http specs, sending a body is also valid in a GET call. Cause E-Mail Addresses are privacy relevant, we don’t like to have it in the URL (as path part or query parameter).
This endpoint does not modify anything, so POST is not a correct method to do so.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (1 by maintainers)
Top Results From Across the Web
HTTP GET with request body - Stack Overflow
Yes. In other words, any HTTP request message is allowed to contain a message body, and thus must parse messages with that in...
Read more >Request bodies in GET requests - Evert Pot
Yes. In other words, any HTTP request message is allowed to contain a message body, and thus must parse messages with that in...
Read more >GET - HTTP - MDN Web Docs
It is better to just avoid sending payloads in GET requests. Request has body, No. Successful response has body, Yes. Safe, Yes. Idempotent,...
Read more >Use Case of HTTP GET Request with a Body
So, yes, you can send a body with GET, and no, it is never useful to do so. " The actual answer has...
Read more >Limitations of the GET method in HTTP - Dropbox Tech Blog
GET requests don't have a request body, so all parameters must appear in the URL or in a header. While the HTTP standard...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Has there been any follow up on this? OpenAPI did end up allowing a request body on GET requests. Should this be re-opened?
Apparently, If swagger sticks to the OpenAPI standard, we should avoid using swagger with Spring MVC, since Spring MVC allows GET request with a body.
If Swagger does not allow this, we have to seek alternatives, either Swagger or Spring MVC. Given we already have so many applications running in production, it’s unlikely we replace the application framework, we have to replace Swagger.