GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • httpYac
  • CLI
  • VSCode
  • VSCode Notebook
  • Docker
  • Request
  • MetaData
  • Variables
  • Environments
  • Scripting
  • Assert
  • Comment
  • Hooks
  • Response

This view

  • Original page
  • New address

GeezerVison is showing httpyac.github.io — Meta Data | httpYac

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.

HTTP
# @name json
GET https://httpbin.org/json

###
# @ref json
POST https://httpbin.org/anything
{{json.slideshow.author}}
1
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

HTTP
GET https://httpbin.org/json

{{
  // post request script
  exports.header = response.headers['content-type'];
}}
1
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

HTTP
# @title get json
GET https://httpbin.org/json
1
2
HTTP
### get json
GET https://httpbin.org/json
1
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)

HTTP
# @description get json content
GET https://httpbin.org/json
1
2

TIP

first comment of a region is automatically used as description

HTTP
/*
get json content
*/
GET https://httpbin.org/json
1
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.

HTTP
# @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}}
1
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.

HTTP
# @import ./name.http
# @ref json
POST https://httpbin.org/anything
{{json.slideshow.author}}
1
2
3
4

Disabled ​

requests can be disabled. It is possible to disable requests dynamically with {{httpRegion.metaData.disabled=true}} in script

HTTP
# @disabled
GET https://httpbin.org/json
###

// @disabled

GET /xml
1
2
3
4
5
6
7

It is possible to use a condition/ javascript expression which is interpreted to disable requests

HTTP
@callRequest={{false}}
###

# @disabled !callRequest
GET https://httpbin.org/json
1
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

HTTP
# @jwt data

POST https://httpbin.org/anything
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
1
2
3
4

Inject Variables ​

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

HTTP
# @injectVariables
@foo=bar

POST https://httpbin.org/anything
< ./variables.json
1
2
3
4
5

Note ​

shows a confirmation dialog before sending request

HTTP
# @note Are you sure?
DELETE https://httpbin.org/anything
1
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

HTTP
{{
  exports.data = [1, 2, 3];
}}
###
# @loop for item of data
GET https://httpbin.org/anything?item={{item}}
1
2
3
4
5
6

for ... ​

Variable $index is injected in Variables for every iteration

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

while ... ​

Variable $index is injected in Variables for every iteration

HTTP
{{
  exports.expression = {
    index: 0,
  };
}}
###
# @loop while expression.index < 3
GET /anything?item={{expression.index++}}
1
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,...).

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

###
# @ref foo
POST https://httpbin.org/anything?result={{foo3.args.item}}
1
2
3
4
5
6
7

GRPC Reflection ​

Enable Grpc Reflection lookup for current grpc server

HTTP
# @grpc-reflection
GRPC grpc.postman-echo.com/HelloService/sayHello
{
  "greeting": "world"
}
1
2
3
4
5

Save ​

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

HTTP
# @save
GET https://httpbin.org/json
1
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.

HTTP
# @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
1
2
3
4
5

WARNING

Meta Data is ignored in CLI and Httpbook

Extension ​

Change Extension of file for save or openWith.

HTTP
# @save
# @extension gson
GET https://httpbin.org/json
1
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)

HTTP
# @ratelimit minIdleTime 10000

GET /json
1
2
3

The maximum number of requests in a defined period of time can also be enforced (expire in milliseconds).

HTTP
# @ratelimit max 10 expire: 60000

GET /json
1
2
3

The network cap can also be divided into slots

HTTP
# @ratelimit slot bar minIdleTime 10000
GET /json
###
# @ratelimit slot foo minIdleTime 10000
GET /json
1
2
3
4
5

All limitations can also be combined

HTTP
# @ratelimit minIdleTime 10000 max 10 expire: 60000

GET /json
1
2
3

Sleep ​

Sleep/ Wait defined milliseconds

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

No log ​

Prevent logging of request data in output console

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

No Response View ​

Prevent open response in editor of VSCode

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

No Streaming Log ​

Prevent logging of intermediate responses while streaming data in output console

HTTP
proto < ./hello.proto

# @noStreamingLog

GRPC grpc.postman-echo.com/HelloService/LotsOfReplies
{
  "greeting": "world"
}
1
2
3
4
5
6
7
8

No CookieJar ​

cookieJar support is disabled for this request

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

No Client Certificate ​

SSL client certificate is not send for this request

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

No Redirect ​

Prevent following Redirects

HTTP
# @no-redirect

GET https://httpbin.org/absolute-redirect/2
1
2
3

No Reject Unauthorized ​

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

HTTP
# @no-reject-unauthorized

GET https://client.badssl.com/
X-ClientCert: pfx: ../assets/badssl.com-client.p12 passphrase: badssl.com
1
2
3
4

TIP

Since rejectUnauthorized can be different per environment, it can be set using the special variable request_rejectUnauthorized.

.env
ini
request_rejectUnauthorized=false
1

Proxy ​

Set proxy for requests

HTTP
# @proxy http://localhost:8888

GET https://httpbin.org/json
1
2
3

TIP

Since using a proxy can be different per environment, it can be set using the special variable request_proxy.

prod.env
ini
request_proxy=socks://localhost:1080
1

No Proxy ​

Ignore system proxy setting for requests

HTTP
# @no-proxy

GET https://httpbin.org/json
1
2
3

Debug ​

enable debug log level

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

Verbose ​

enable trace log level

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

keepStreaming ​

keep streaming of MQTT, Server-Sent-Events or WebSocket until the session is ended manually.

HTTP
# @keepStreaming
MQTT tcp://broker.hivemq.com
Topic: testtopic/1
1
2
3
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.