[GH-ISSUE #2177] [feature]: Allow fire other requests in pre-request scripts #739

Closed
opened 2026-03-16 16:58:39 +03:00 by kerem · 4 comments
Owner

Originally created by @xpol on GitHub (Mar 19, 2022).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2177

Is there an existing issue for this?

  • I have searched the existing issues

Summary

Allow run requests before requests.

In pre-request scripts and tests, allow invoking other requests (with their pre-script scripts and tests scripts).

Why should this be worked on?

So that we can do complex requests flow with advanced features:

A -> B -> <?> -> C
           |
           +-> D -> E
Originally created by @xpol on GitHub (Mar 19, 2022). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2177 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Summary Allow run requests before requests. In pre-request scripts and tests, allow invoking other requests (with their pre-script scripts and tests scripts). ### Why should this be worked on? So that we can do complex requests flow with advanced features: ``` A -> B -> <?> -> C | +-> D -> E ```
kerem 2026-03-16 16:58:39 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@AndrewBastin commented on GitHub (Mar 21, 2022):

@xpol can you provide an example scenario where you might want a feature like this ?

<!-- gh-comment-id:1073474281 --> @AndrewBastin commented on GitHub (Mar 21, 2022): @xpol can you provide an example scenario where you might want a feature like this ?
Author
Owner

@xpol commented on GitHub (Mar 21, 2022):

For example,
I want a login request to get the token, then call the other API like get user information.

<!-- gh-comment-id:1073511564 --> @xpol commented on GitHub (Mar 21, 2022): For example, I want a login request to get the token, then call the other API like get user information.
Author
Owner

@xpol commented on GitHub (Mar 21, 2022):

I know we can fire requests in the script via requests API, like in postman

pm.sendRequest({
        url: '/api/login',
        method: 'POST',
        header: {
            'content-type': 'application/json',
            'api-key': apiKey,
        },
        body: {
            mode: 'raw',
            raw : JSON.stringify({ username, password })
        }
    }, (err, res) => {
        if (err) {
            throw err;
        }

        const auth = res.json();
        pm.collectionVariables.set('token', auth.access_token);
    });

but I want to reuse existing requests managed by hoppscotch instead of writing scripts like above.

<!-- gh-comment-id:1073517364 --> @xpol commented on GitHub (Mar 21, 2022): I know we can fire requests in the script via requests API, like in postman ```javascript pm.sendRequest({ url: '/api/login', method: 'POST', header: { 'content-type': 'application/json', 'api-key': apiKey, }, body: { mode: 'raw', raw : JSON.stringify({ username, password }) } }, (err, res) => { if (err) { throw err; } const auth = res.json(); pm.collectionVariables.set('token', auth.access_token); }); ``` but I want to reuse existing requests managed by hoppscotch instead of writing scripts like above.
Author
Owner

@liyasthomas commented on GitHub (Apr 7, 2022):

Possibly a duplicate of #2205, hence closing.

<!-- gh-comment-id:1091724843 --> @liyasthomas commented on GitHub (Apr 7, 2022): Possibly a duplicate of #2205, hence closing.
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#739
No description provided.