[GH-ISSUE #5776] [question]: pm.sendRequest usage on pre-request script #2259

Closed
opened 2026-03-16 23:45:54 +03:00 by kerem · 1 comment
Owner

Originally created by @Leon-Luu on GitHub (Jan 16, 2026).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5776

Is there an existing issue for this?

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

Platform

Web App

Browser

Chrome

Operating System

Windows

Bug Description

When executing the pm.sendRequest from the Pre-request Script it will resulting as TypeError as failure.
If the code is executed in Post-request script it is working fine.
I beleive that pm.sendRequest should be supported for "Pre-request Script" as well, if not I am requesting this :)

Image Image

Deployment Type

Hoppscotch Cloud

Version

v2025.12.1

Originally created by @Leon-Luu on GitHub (Jan 16, 2026). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5776 ### Is there an existing issue for this? - [x] I have searched existing issues and this bug hasn't been reported yet ### Platform Web App ### Browser Chrome ### Operating System Windows ### Bug Description When executing the pm.sendRequest from the Pre-request Script it will resulting as TypeError as failure. If the code is executed in Post-request script it is working fine. I beleive that **pm.sendRequest** should be supported for "Pre-request Script" as well, if not I am requesting this :) <img width="1261" height="940" alt="Image" src="https://github.com/user-attachments/assets/e084a743-c781-4cfb-aa78-faf0cd08d001" /> <img width="1656" height="740" alt="Image" src="https://github.com/user-attachments/assets/163bd765-9cdf-47e2-b624-ff5365950b2d" /> ### Deployment Type Hoppscotch Cloud ### Version v2025.12.1
kerem closed this issue 2026-03-16 23:45:59 +03:00
Author
Owner

@jamesgeorge007 commented on GitHub (Jan 16, 2026):

Hi, the ability to send requests from the scripting context is supported in both pre-request and post-request scripts. However, the sample snippet encountered issues because the pm.expect() function is not recognised in pre-request scripts. Ideally, this would be flagged via IntelliSense.

We are aware of cases where type definitions can overlap between scripting editors, causing certain functions to appear valid when they are not. This is being tracked separately and would cease to exist once the unified scripting experience is in place.

Image
<!-- gh-comment-id:3759716579 --> @jamesgeorge007 commented on GitHub (Jan 16, 2026): Hi, the ability to send requests from the scripting context is supported in both pre-request and post-request scripts. However, the sample snippet encountered issues because the `pm.expect()` function is not recognised in pre-request scripts. Ideally, this would be flagged via IntelliSense. We are aware of cases where type definitions can overlap between scripting editors, causing certain functions to appear valid when they are not. This is being tracked separately and would cease to exist once the unified scripting experience is in place. <img width="763" height="403" alt="Image" src="https://github.com/user-attachments/assets/da0a84fe-1e23-4424-82be-f40107235606" />
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#2259
No description provided.