question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GET request do not allow a body

See original GitHub issue

Q&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:closed
  • Created 4 years ago
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
tseale07commented, Jul 23, 2020

Has there been any follow up on this? OpenAPI did end up allowing a request body on GET requests. Should this be re-opened?

3reactions
niulincommented, Jun 27, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found