Meta Data
All lines starting with #
are interpreted as meta data lines. Lines in Format # @foo bar
are interpreted as meta data (or alternatively // @foo
because of Intellij). It is possible to attach meta data that influences the processing of the request
Name
Responses of a requests with a Name are automatically added as Variables and can be reused by other Requests. The variable contains the response body. If the body is valid JSON, this will be parsed automatically.
# @name json
GET https://httpbin.org/json
###
# @ref json
POST https://httpbin.org/anything
{{json.slideshow.author}}
2
3
4
5
6
7
WARNING
Name must be unique in all imported files, there is no scope support and first found request with name will be used.
WARNING
Variable Name must be a valid Javascript Variable Name. No Javascript keywords like import, var, ... are allowed.
To access response headers, the variable response
can be used in post request scripts
GET https://httpbin.org/json
{{
// post request script
exports.header = response.headers['content-type'];
}}
2
3
4
5
6
Title
additional title of region (used in cli output and outline view). It is possible to define title in region delimiter
# @title get json
GET https://httpbin.org/json
2
### get json
GET https://httpbin.org/json
2
TIP
If no other name is specified title after ###
is also used as name
Description
additional description of region (used in cli output and outline view)
# @description get json content
GET https://httpbin.org/json
2
TIP
first comment of a region is automatically used as description
/*
get json content
*/
GET https://httpbin.org/json
2
3
4
Ref and ForceRef
Requests can reference other requests. When the request is called, it is ensured that the referenced Request is called beforehand. forceRef
always call the other request. ref
only calls if no response is cached.
# @name json
GET https://httpbin.org/anything?id={{$guid}}
###
# @ref json
POST https://httpbin.org/anything
{{json.args.id}}
###
# @forceRef json
POST https://httpbin.org/anything
{{json.args.id}}
2
3
4
5
6
7
8
9
10
11
12
TIP
It is possible to reference any number of requests.
TIP
Referencing also makes the variables of the other region accessible and thus also the named response body.
Import
To reference Requests from other files, these must first be imported. Imported files are enabled for all requests in one file.
# @import ./name.http
# @ref json
POST https://httpbin.org/anything
{{json.slideshow.author}}
2
3
4
Disabled
requests can be disabled. It is possible to disable requests dynamically with {{httpRegion.metaData.disabled=true}} in script
# @disabled
GET https://httpbin.org/json
###
// @disabled
GET /xml
2
3
4
5
6
7
It is possible to use a condition/ javascript expression which is interpreted to disable requests
@callRequest={{false}}
###
# @disabled !callRequest
GET https://httpbin.org/json
2
3
4
5
JWT
jwt meta data supports auto decode of jwt token. just provide property in response to decode and it is added to the promise with ${property}_parsed
# @jwt data
POST https://httpbin.org/anything
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
2
3
4
Inject Variables
Inject Variables in request body (needed because of compatibility with Intellij)
# @injectVariables
@foo=bar
POST https://httpbin.org/anything
< ./variables.json
2
3
4
5
Note
shows a confirmation dialog before sending request
# @note Are you sure?
DELETE https://httpbin.org/anything
2
Loop
Allows multiple Invocations of a Request with different parameters.
for ... of ...
Variable $index
and Variable Name is injected in Variables for every iteration
{{
exports.data = [1, 2, 3];
}}
###
# @loop for item of data
GET https://httpbin.org/anything?item={{item}}
2
3
4
5
6
for ...
Variable $index
is injected in Variables for every iteration
# @loop for 4
GET https://httpbin.org/anything?item={{$index}}
2
while ...
Variable $index
is injected in Variables for every iteration
{{
exports.expression = {
index: 0,
};
}}
###
# @loop while expression.index < 3
GET /anything?item={{expression.index++}}
2
3
4
5
6
7
8
TIP
An index is automatically appended to the Name of the request, which can be used to access it in subsequent requests (name=foo => foo0, foo1,...).
# @loop for 4
# @name foo
GET https://httpbin.org/anything?item={{$index}}
###
# @ref foo
POST https://httpbin.org/anything?result={{foo3.args.item}}
2
3
4
5
6
7
GRPC Reflection
Enable Grpc Reflection lookup for current grpc server
# @grpc-reflection
GRPC grpc.postman-echo.com/HelloService/sayHello
{
"greeting": "world"
}
2
3
4
5
Save
If @save
is specified, the response will not be displayed but saved directly.
# @save
GET https://httpbin.org/json
2
WARNING
Meta Data is ignored in CLI and Httpbook
OpenWith
Provide viewType of custom editor to preview files. If content-type header of the response is image, files will be previewed automatically with built-in image preview. If content-type is application/pdf
and extension vscode-pdf is installed, it will be used for preview.
# @openWith imagePreview.previewEditor
GET https://raw.githubusercontent.com/AnWeber/vscode-httpyac/master/icon.png
GET https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf
2
3
4
5
WARNING
Meta Data is ignored in CLI and Httpbook
Extension
Change Extension of file for save or openWith.
# @save
# @extension gson
GET https://httpbin.org/json
2
3
WARNING
Meta Data is ignored in CLI and Httpbook
RateLimit
throttle requests to limit network traffic.
It is possible to force a minimum idle time between 2 requests (minIdleTime in milliseconds)
# @ratelimit minIdleTime 10000
GET /json
2
3
The maximum number of requests in a defined period of time can also be enforced (expire in milliseconds).
# @ratelimit max 10 expire: 60000
GET /json
2
3
The network cap can also be divided into slots
# @ratelimit slot bar minIdleTime 10000
GET /json
###
# @ratelimit slot foo minIdleTime 10000
GET /json
2
3
4
5
All limitations can also be combined
# @ratelimit minIdleTime 10000 max 10 expire: 60000
GET /json
2
3
Sleep
Sleep/ Wait defined milliseconds
# @sleep 10000
GET https://httpbin.org/json
2
No log
Prevent logging of request data in output console
# @no-log
GET https://httpbin.org/json
2
No Response View
Prevent open response in editor of VSCode
# @no-response-view
GET https://httpbin.org/json
2
No Streaming Log
Prevent logging of intermediate responses while streaming data in output console
proto < ./hello.proto
# @noStreamingLog
GRPC grpc.postman-echo.com/HelloService/LotsOfReplies
{
"greeting": "world"
}
2
3
4
5
6
7
8
No CookieJar
cookieJar support is disabled for this request
# @no-cookie-jar
GET https://www.google.de
2
No Client Certificate
SSL client certificate is not send for this request
# @no-client-cert
GET https://client.badssl.com/
X-ClientCert: pfx: ../assets/badssl.com-client.p12 passphrase: badssl.com
2
3
No Redirect
Prevent following Redirects
# @no-redirect
GET https://httpbin.org/absolute-redirect/2
2
3
No Reject Unauthorized
All invalid SSL certificates will be ignored and no error will be thrown.
# @no-reject-unauthorized
GET https://client.badssl.com/
X-ClientCert: pfx: ../assets/badssl.com-client.p12 passphrase: badssl.com
2
3
4
TIP
Since rejectUnauthorized can be different per environment, it can be set using the special variable request_rejectUnauthorized
.
request_rejectUnauthorized=false
Proxy
Set proxy for requests
# @proxy http://localhost:8888
GET https://httpbin.org/json
2
3
TIP
Since using a proxy can be different per environment, it can be set using the special variable request_proxy
.
request_proxy=socks://localhost:1080
No Proxy
Ignore system proxy setting for requests
# @no-proxy
GET https://httpbin.org/json
2
3
Debug
enable debug log level
# @debug
GET https://httpbin.org/json
2
Verbose
enable trace log level
# @verbose
GET https://httpbin.org/json
2
keepStreaming
keep streaming of MQTT, Server-Sent-Events or WebSocket until the session is ended manually.
# @keepStreaming
MQTT tcp://broker.hivemq.com
Topic: testtopic/1
2
3