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 Intellijopen in new window). 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 HTTP/1.1

###
# @ref json
POST https://httpbin.org/anything HTTP/1.1
{{json.slideshow.author}}
 






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 responseopen in new window can be used in post request scripts

GET https://httpbin.org/json HTTP/1.1

{{
  // post request script
  exports.header = response.headers['content-type'];
}}




 

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 HTTP/1.1
 

### get json
GET https://httpbin.org/json HTTP/1.1
 

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 HTTP/1.1
 

TIP

first comment of a region is automatically used as description

/*
get json content
*/
GET https://httpbin.org/json HTTP/1.1
 
 
 

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/json HTTP/1.1

###
# @ref json
POST https://httpbin.org/anything HTTP/1.1
{{json.slideshow.author}}

###
# @forceRef json
POST https://httpbin.org/anything HTTP/1.1
{{json.slideshow.author}}
 



 




 


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 HTTP/1.1
{{json.slideshow.author}}
 



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 HTTP/1.1
###

// @disabled

GET /xml
 






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 HTTP/1.1
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
 



Inject Variables

Inject Variables in request body (needed because of compatibility with Intellij)

# @injectVariables
@foo=bar

POST https://httpbin.org/anything HTTP/1.1
< ./variables.json
 




Note

shows a confirmation dialog before sending request

# @note Are you sure?
DELETE https://httpbin.org/anything HTTP/1.1
 

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}} HTTP/1.1




 

for ...

Variable $index is injected in Variables for every iteration

# @loop for 4
GET https://httpbin.org/anything?item={{$index}} HTTP/1.1
 

while ...

Variable $index is injected in Variables for every iteration

{{
  exports.expression = {
    index: 0,
  };
}}
###
# @loop while expression.index < 3
GET /anything?item={{expression.index++}} HTTP/1.1






 

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}} HTTP/1.1

###
# @ref foo
POST https://httpbin.org/anything?result={{foo3.args.item}} HTTP/1.1





 

Save

If @save is specified, the response will not be displayed but saved directly.

# @save
GET https://httpbin.org/json HTTP/1.1
 

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-pdfopen in new window is installed, it will be used for preview.

# @openWith imagePreview.previewEditor
GET https://raw.githubusercontent.com/AnWeber/vscode-httpyac/master/icon.png HTTP/1.1


GET https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf HTTP/1.1
 




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 HTTP/1.1

 

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 HTTP/1.1
 


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 HTTP/1.1
 


The network cap can also be divided into slots

# @ratelimit slot bar minIdleTime 10000
GET /json HTTP/1.1
###
# @ratelimit slot foo minIdleTime 10000
GET /json HTTP/1.1
 




All limitations can also be combined

# @ratelimit minIdleTime 10000 max 10 expire: 60000

GET /json HTTP/1.1
 


Sleep

Sleep/ Wait defined milliseconds

# @sleep 10000
GET https://httpbin.org/json HTTP/1.1
 

No log

Prevent logging of request data in output console

# @no-log
GET https://httpbin.org/json HTTP/1.1
 

No Response View

Prevent open response in editor of VSCode

# @no-response-view
GET https://httpbin.org/json HTTP/1.1
 

No Streaming Log

Prevent logging of intermediate responses while streaming data in output console

proto < ./hello.proto

# @noStreamingLog

GRPC grpcb.in:9000/hello.HelloService/LotsOfReplies
{
  "greeting": "world"
}


 





No CookieJar

cookieJar support is disabled for this request

# @no-cookie-jar
GET https://www.google.de HTTP/1.1
 

No Client Certificate

SSL client certificate is not send for this request

# @no-client-cert
GET https://client.badssl.com/ HTTP/1.1
X-ClientCert: pfx: ../assets/badssl.com-client.p12 passphrase: badssl.com
 


No Redirect

Prevent following Redirects

# @no-redirect

GET https://httpbin.org/absolute-redirect/2 HTTP/1.1
 


No Reject Unauthorized

All invalid SSL certificates will be ignored and no error will be thrown.

# @no-reject-unauthorized

GET https://client.badssl.com/ HTTP/1.1
X-ClientCert: pfx: ../assets/badssl.com-client.p12 passphrase: badssl.com
 



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 http requests

# @proxy http://localhost:8888

GET https://httpbin.org/json HTTP/1.1
 


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

Debug

enable debug log level

# @debug
GET https://httpbin.org/json HTTP/1.1
 

Verbose

enable trace log level

# @verbose
GET https://httpbin.org/json HTTP/1.1
 

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

 



Last Updated: