Skip to content

feat: enable manipulation on insomnia.request - INS-3379#7145

Merged
jackkav merged 8 commits intodevelopfrom
pre-script-set-req
Mar 8, 2024
Merged

feat: enable manipulation on insomnia.request - INS-3379#7145
jackkav merged 8 commits intodevelopfrom
pre-script-set-req

Conversation

@ihexxa
Copy link
Contributor

@ihexxa ihexxa commented Mar 5, 2024

This change basically sets up insomnia.request for manipuating request before sending.

  • enable insomnia.request
  • added a test for it
  • add interfaces.ts for common interfaces
  • aggregate some requests to pre-request-collection.yaml

How to test

Run the following script and check if it works well:

                const { Header } = require('insomnia-collection');
                insomnia.request.method = 'GET';
                insomnia.request.url.addQueryParams('k1=v1');
                insomnia.request.headers.add(new Header({
                    key: 'Content-Type',
                    value: 'text/plain'
                }));
                insomnia.request.headers.add(new Header({
                    key: 'X-Hello',
                    value: 'hello'
                }));
                insomnia.request.body.update({
                    mode: 'raw',
                    raw: 'rawContent',
                });
                insomnia.request.auth.update(
                    {
                        type: 'bearer',
                        bearer: [
                                {key: 'token', value: 'tokenValue'},
                        ],
                    },
                    'bearer'
                );

@jackkav jackkav force-pushed the pre-script-set-req branch from 2fab7e1 to f59ad32 Compare March 8, 2024 15:22
@jackkav jackkav merged commit bdd0d42 into develop Mar 8, 2024
@jackkav jackkav deleted the pre-script-set-req branch March 8, 2024 15:40
jackkav pushed a commit to jackkav/insomnia that referenced this pull request Mar 13, 2024
* feat: enable manipulation on insomnia.request

* chore: revert changes on test

* fix: lint errors

* chore: clean up dependencies

* fix: lint error

* fix: smoke test failure

* chore: fix and re-org pre-request scripts

* fix: bring back request test in smoke spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants