github unkn0wn-root/resterm v0.21.4

latest releases: v0.39.5, v0.39.4, v0.39.3...
3 months ago

What's Changed

New: @patch profiles and @apply use=

You can now define named patch profiles with @patch and reference them from any request with @apply use=. This is useful when several requests share the same headers, auth setup, or other overrides, so instead of copying the same @apply block everywhere, you define it once and reference it by name.

# @patch file jsonApi {headers: {"Accept": "application/json", "Content-Type": "application/json"}}
# @patch global authProd {auth: {type: "oauth2", cache_key: "myapi"}}

### Create item
# @apply use=jsonApi,use=authProd
POST https://api.example.com/items

Both profiles are applied left to right before the request runs. When a file-scoped and a global profile share the same name, the file-scoped one wins.

auth and settings in @apply

  • The @apply patch dict now supports two additional keys. You can set authentication on the fly with auth or adjust per-request settings like timeouts with settings. Passing null clears the value.
# @apply {auth: {type: "bearer", token: vars.get("tok")}, settings: {timeout: "5s"}}
GET https://api.example.com/me

Don't miss a new resterm release

NewReleases is sending notifications on new releases.