@scalar/pre-post-request-scripts
v0.3.15
Published
Execute pre-request and post-response scripts in the Scalar API Client
Readme
Scalar Scripts
Post-response scripts for your OpenAPI documents.
Scripts are executed with the official Postman sandbox runtime (postman-sandbox), so the pm API behavior follows Postman semantics.
Note: This is intended to be used as a plugin with @scalar/api-client.
Installation
npm install @scalar/pre-post-request-scriptsUsage
import { createApiClientWeb } from '@scalar/api-client/layouts/Web'
import { postResponseScriptsPlugin } from '@scalar/pre-post-request-scripts'
import '@scalar/api-client/style.css'
createApiClientWeb(
document.getElementById('app'),
{
proxyUrl: 'https://proxy.scalar.com',
// Load the plugin
plugins: [
postResponseScriptsPlugin()
],
},
)Script Runtime
- Uses the official Postman sandbox package: https://github.com/postmanlabs/postman-sandbox
- Scripts run as Postman
testscripts, sopm.response,pm.test, andpm.expectare provided by Postman - Script results are surfaced in the Tests panel via the plugin
Community
We are API nerds. You too? Let's chat on Discord: https://discord.gg/scalar
License
The source code in this repository is licensed under MIT.
