8000 feat(api-client): post-response scripts 🏃‍♂️‍➡️ by hanspagel · Pull Request #4968 · scalar/scalar · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(api-client): post-response scripts 🏃‍♂️‍➡️ #4968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

hanspagel
Copy link
Member
@hanspagel hanspagel commented Mar 4, 2025

Problem

Currently, you can’t execute any code after a response was received. 😭 Is this even a pro tool?

Solution

With this PR you can execute arbitrary code after a request was sent.

We even support (part of) the Postman API to make the switch easy.

Tasks

Preview

Request Response
image image

Test

pm.test("Status code is 200", async () => {
  await new Promise(r => setTimeout(r, 100))
  pm.response.to.have.status(200)
})

pm.test("Response time is less than 200ms", function () {
  pm.expect(pm.response.responseTime).to.be.below(200)
})

Checklist

I’ve gone through the following:

  • I’ve added an explanation why this change is needed.
  • I’ve added a changeset (pnpm changeset).
  • I’ve added tests for the regression or new feature.
  • I’ve updated the documentation.

@hanspagel hanspagel self-assigned this Mar 4, 2025
Copy link
changeset-bot bot commented Mar 4, 2025

⚠️ No Changeset found

Latest commit: e89b99b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@antlio antlio force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch from 0d890c2 to 6c94858 Compare March 4, 2025 18:52
Copy link
relativeci bot commented Mar 4, 2025

#9097 Bundle Size — 2.41MiB (+0.06%).

2c56faf(current) vs adc6ee4 main#9096(baseline)

Warning

Bundle contains 6 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#9097
     Baseline
#9096
Regression  Initial JS 2.41MiB(+0.06%) 2.41MiB
No change  Initial CSS 0B 0B
No change  Cache Invalidation 100% 100%
No change  Chunks 1 1
No change  Assets 1 1
Change  Modules 1483(+0.07%) 1482
No change  Duplicate Modules 0 0
No change  Duplicate Code 0% 0%
No change  Packages 172 172
No change  Duplicate Packages 6 6
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#9097
     Baseline
#9096
Regression  JS 2.41MiB (+0.06%) 2.41MiB

Bundle analysis reportBranch api-docs-issue-DOC-2683-add-prep...Project dashboard


Generated by RelativeCIDocumentationReport issue

Copy link
Contributor
github-actions bot commented Mar 4, 2025

Cloudflare Preview for the API Client

https://be8c69f0.client-staging-7m0.pages.dev

Copy link
Contributor
github-actions bot commented Mar 4, 2025

@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch 3 times, most recently from 49488ac to 25cb65e Compare March 6, 2025 08:30
@antlio antlio force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch 3 times, most recently from 73cf993 to 81a5414 Compare March 8, 2025 14:47
<!-- Spacer -->
<div class="-my-0.25 flex flex-grow" />
<div class="-mt-0.25 z-1 flex flex-grow border-b" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn’t we use the z-index presets instead of a specific number?

@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch 3 times, most recently from 6938b53 to ce724ec Compare March 12, 2025 11:29
@antlio antlio force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch from ce724ec to b588fa0 Compare March 13, 2025 09:49
@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch 6 times, most recently from 66e52ee to a53fc58 Compare March 20, 2025 10:54
@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch 2 times, most recently from a698dec to 511c249 Compare April 2, 2025 09:59
@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch from f9f7a53 to f224366 Compare April 2, 2025 15:26
@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch 3 times, most recently from 206f926 to 4212438 Compare April 28, 2025 13:47
@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch 2 times, most recently from 19e510b to d508987 Compare May 5, 2025 10:01
@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch from 2b60e18 to 16241de Compare May 7, 2025 07:50
@hanspagel hanspagel force-pushed the api-docs-issue-DOC-2683-add-prepost-request-scripts branch from 16241de to e89b99b Compare May 16, 2025 09:43
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.

1 participant
0