[GH-ISSUE #3974] [bug]: REST GET request always send null body #1397

Open
opened 2026-03-16 20:10:08 +03:00 by kerem · 8 comments
Owner

Originally created by @gturi on GitHub (Apr 12, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3974

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When sending a GET request with a body the body is not sent but the curl is correctly generated. Even though a GET request with body is not standard by REST specification it is still possible to create a REST endpoint that accepts a body.

Steps to reproduce

  1. Create a get request with a json body.
  2. Send it to an endpoint.
  3. Verify that the received body is null.

Environment

Production

Version

Cloud

Originally created by @gturi on GitHub (Apr 12, 2024). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3974 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior When sending a GET request with a body the body is not sent but the curl is correctly generated. Even though a GET request with body is not standard by REST specification it is still possible to create a REST endpoint that accepts a body. ### Steps to reproduce 1. Create a get request with a json body. 2. Send it to an endpoint. 3. Verify that the received body is null. ### Environment Production ### Version Cloud
Author
Owner

@aryans1319 commented on GitHub (Apr 15, 2024):

Hey @gturi I want to work on this can you assign this to me?

<!-- gh-comment-id:2056776478 --> @aryans1319 commented on GitHub (Apr 15, 2024): Hey @gturi I want to work on this can you assign this to me?
Author
Owner

@gturi commented on GitHub (Apr 15, 2024):

@aryans1319 I am not the owner of the repo, so I do not think I can assign it to you. But if you want to work on it, I think you can fork the repo and create a branch that closes this issue

<!-- gh-comment-id:2057056242 --> @gturi commented on GitHub (Apr 15, 2024): @aryans1319 I am not the owner of the repo, so I do not think I can assign it to you. But if you want to work on it, I think you can fork the repo and create a branch that closes this issue
Author
Owner

@gturi commented on GitHub (Jun 4, 2024):

@Liamhhhhh even though that product may work, I would prefer to just have it fixed here. Moreover, as far as I know that product is not open source, and I do not want to go back to a Postman-like situation where I get locked in to a closed source vendor which at a certain point decides that all the APIs I develop are must be uploaded to their servers.

<!-- gh-comment-id:2146703787 --> @gturi commented on GitHub (Jun 4, 2024): @Liamhhhhh even though that product may work, I would prefer to just have it fixed here. Moreover, as far as I know that product is not open source, and I do not want to go back to a Postman-like situation where I get locked in to a closed source vendor which at a certain point decides that all the APIs I develop are must be uploaded to their servers.
Author
Owner

@iDschepe commented on GitHub (Dec 17, 2024):

Experiencing the same issue. Would love to see that fixed.

<!-- gh-comment-id:2548382645 --> @iDschepe commented on GitHub (Dec 17, 2024): Experiencing the same issue. Would love to see that fixed.
Author
Owner

@moaminsharifi commented on GitHub (Jan 27, 2025):

Still not fixed, can I help to fix it?

<!-- gh-comment-id:2615192543 --> @moaminsharifi commented on GitHub (Jan 27, 2025): Still not fixed, can I help to fix it?
Author
Owner

@jankarres commented on GitHub (Feb 12, 2025):

If no interceptor is used in Hoppscotch, Hoppscotch sends REST API requests with the named problem in the file hoppscotch-common/src/platform/std/interceptors/browser.ts to the server using Axios. Hoppscotch passes the complete body of the GET request to axios as data.

Image

Axios adheres to standards. RFC 7231 states:

A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.

Axios therefore rejects the body in accordance with the standard. The “problem” is therefore not with Hoppscotch, but with Axios, which adheres to the defined standard.

However, bodies are still used in GET requests in some APIs. One possible solution would be to configure Axios in such a way that it forces Axios to send the body with GET requests, contrary to the standard (this is what e.g. Postman basically does):

    const res = await axios({
      ...req,
      cancelToken,
      responseType: "arraybuffer",
      transformRequest: [(data) => data], // prevents the removal of the body by Axios
    })

If the Hoppscotch team want to allow using this not standard conform behavior is up to them.

<!-- gh-comment-id:2654323460 --> @jankarres commented on GitHub (Feb 12, 2025): If no interceptor is used in Hoppscotch, Hoppscotch sends REST API requests with the named problem in the file `hoppscotch-common/src/platform/std/interceptors/browser.ts` to the server using [Axios](http://npmjs.com/package/axios). Hoppscotch passes the complete body of the GET request to axios as `data`. ![Image](https://github.com/user-attachments/assets/22786064-b23d-4737-8b5c-6db8616ba24e) Axios adheres to standards. [RFC 7231](https://www.rfc-editor.org/rfc/rfc7231#section-4.3.1) states: > A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request. Axios therefore rejects the body in accordance with the standard. The “problem” is therefore not with Hoppscotch, but with Axios, which adheres to the defined standard. However, bodies are still used in GET requests in some APIs. One possible solution would be to configure Axios in such a way that it forces Axios to send the body with GET requests, contrary to the standard (this is what e.g. Postman basically does): ``` const res = await axios({ ...req, cancelToken, responseType: "arraybuffer", transformRequest: [(data) => data], // prevents the removal of the body by Axios }) ``` If the Hoppscotch team want to allow using this not standard conform behavior is up to them.
Author
Owner

@btrazzini commented on GitHub (Apr 3, 2025):

How do I fix using Hoppscotch web?

<!-- gh-comment-id:2776578138 --> @btrazzini commented on GitHub (Apr 3, 2025): How do I fix using Hoppscotch web?
Author
Owner

@pedrojreis commented on GitHub (Feb 13, 2026):

Damn what a trip i had debuging my api calls due to this :) a client does require a body with GET and I was getting blocked haha
Any news on this? :)

Funny enough if we use hoppscotch proxy the body is sent :D

<!-- gh-comment-id:3897760105 --> @pedrojreis commented on GitHub (Feb 13, 2026): Damn what a trip i had debuging my api calls due to this :) a client does require a body with GET and I was getting blocked haha Any news on this? :) Funny enough if we use hoppscotch proxy the body is sent :D
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1397
No description provided.