[GH-ISSUE #5410] [bug]: WHY PRE-REQUEST SCRIPT CAN NOT USE "fetch"????? #2075

Closed
opened 2026-03-16 23:05:17 +03:00 by kerem · 4 comments
Owner

Originally created by @xzajyjs on GitHub (Sep 27, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5410

Is there an existing issue for this?

  • I have searched existing issues and this bug hasn't been reported yet

Platform

Desktop App

Browser

Chrome

Operating System

macOS

Bug Description

Title suggestion:

Pre-request script: no support for fetch or custom HTTP requests?

Body:

I ran into a major limitation when using pre-request scripts in Hoppscotch.

No matter what JavaScript code I write in the pre-request script, as soon as I try to use fetch—one of the most fundamental and widely used HTTP request functions in JavaScript—it fails. Even something as simple as a plain GET request with no params or body will throw an error. To make things worse, the error messages are not informative at all, so debugging is nearly impossible.

This limitation makes me seriously frustrated, especially since one of the most common real-world scenarios is chaining requests across multiple APIs: passing secrets, keys, or tokens step by step to reach a secure endpoint. Without the ability to make a request (or at least reuse responses from another request in a collection), pre-request scripts lose much of their usefulness.

I spent a lot of time digging through the documentation (72 hours straight, literally line by line), but I found no mention of this. Other tools (e.g. Postman, Insomnia) highlight this feature as essential, and some even provide automatic conversion for Postman pre-request scripts. For a project with 70k+ stars, it’s surprising that such a basic capability seems to be missing.

Questions:

1.	Is there really no way to send an HTTP request inside a pre-request script?
2.	If not, is there at least a way to call another request from the same/different collection and extract a variable from its response?

This is a critical feature for many API testing workflows. If it’s not supported, could it be considered for the roadmap?

Deployment Type

Self-hosted (on-prem deployment)

Version

No response

Image
Originally created by @xzajyjs on GitHub (Sep 27, 2025). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5410 ### Is there an existing issue for this? - [x] I have searched existing issues and this bug hasn't been reported yet ### Platform Desktop App ### Browser Chrome ### Operating System macOS ### Bug Description # Title suggestion: Pre-request script: no support for fetch or custom HTTP requests? # Body: I ran into a major limitation when using pre-request scripts in Hoppscotch. No matter what JavaScript code I write in the pre-request script, as soon as I try to use fetch—one of the most fundamental and widely used HTTP request functions in JavaScript—it fails. Even something as simple as a plain GET request with no params or body will throw an error. To make things worse, the error messages are not informative at all, so debugging is nearly impossible. This limitation makes me seriously frustrated, especially since one of the most common real-world scenarios is chaining requests across multiple APIs: passing secrets, keys, or tokens step by step to reach a secure endpoint. Without the ability to make a request (or at least reuse responses from another request in a collection), pre-request scripts lose much of their usefulness. I spent a lot of time digging through the documentation (72 hours straight, literally line by line), but I found no mention of this. Other tools (e.g. Postman, Insomnia) highlight this feature as essential, and some even provide automatic conversion for Postman pre-request scripts. For a project with 70k+ stars, it’s surprising that such a basic capability seems to be missing. # Questions: 1. Is there really no way to send an HTTP request inside a pre-request script? 2. If not, is there at least a way to call another request from the same/different collection and extract a variable from its response? This is a critical feature for many API testing workflows. If it’s not supported, could it be considered for the roadmap? ### Deployment Type Self-hosted (on-prem deployment) ### Version _No response_ <img width="805" height="763" alt="Image" src="https://github.com/user-attachments/assets/3634455e-1983-4896-9322-fce8c3e94bb3" />
kerem 2026-03-16 23:05:17 +03:00
Author
Owner

@sagar290 commented on GitHub (Oct 3, 2025):

/assign

<!-- gh-comment-id:3366030770 --> @sagar290 commented on GitHub (Oct 3, 2025): /assign
Author
Owner

@RoooyHe commented on GitHub (Oct 10, 2025):

I can't find any way to send HTTP from pre-request when fetch can't be used

<!-- gh-comment-id:3388252918 --> @RoooyHe commented on GitHub (Oct 10, 2025): I can't find any way to send HTTP from pre-request when fetch can't be used
Author
Owner

@jamesgeorge007 commented on GitHub (Nov 19, 2025):

Hi #5596 is now up, implementing fetch(), hopp.fetch(), and pm.sendRequest() in the experimental scripting sandbox as part of the ongoing scripting improvements (https://github.com/hoppscotch/hoppscotch/discussions/5221). This enables making HTTP requests from the scripting context with interceptor integration.

On another note, you can use fetch() in the scripting context with limited capabilities by opting out of the Experimental scripting sandbox via settings.

Image

Please track the further progress in #3305.

<!-- gh-comment-id:3554186805 --> @jamesgeorge007 commented on GitHub (Nov 19, 2025): Hi #5596 is now up, implementing `fetch()`, `hopp.fetch()`, and `pm.sendRequest()` in the experimental scripting sandbox as part of the ongoing scripting improvements (https://github.com/hoppscotch/hoppscotch/discussions/5221). This enables making HTTP requests from the scripting context with [interceptor](https://docs.hoppscotch.io/documentation/features/interceptor) integration. On another note, you can use `fetch()` in the scripting context with limited capabilities by opting out of the `Experimental scripting sandbox` via settings. <img width="2189" height="820" alt="Image" src="https://github.com/user-attachments/assets/487f0530-e328-46bd-a9c8-171418a653a4" /> Please track the further progress in #3305.
Author
Owner

@jamesgeorge007 commented on GitHub (Nov 27, 2025):

The above scripting enhancements are now live with the v2025.11.0 release.

<!-- gh-comment-id:3585215243 --> @jamesgeorge007 commented on GitHub (Nov 27, 2025): The above scripting enhancements are now live with the [v2025.11.0 release](https://github.com/hoppscotch/hoppscotch/releases/tag/2025.11.0).
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#2075
No description provided.