Menu

This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.

Documentationbreadcrumb arrow Grafana k6breadcrumb arrow JavaScript APIbreadcrumb arrow k6/httpbreadcrumb arrow options( url, [body], [params] )
Open source

options( url, [body], [params] )

ParameterTypeDescription
urlstring / HTTP URLRequest URL (e.g. http://example.com).
body (optional)string / object / ArrayBufferRequest body; objects will be x-www-form-urlencoded.
params (optional)objectParams object containing additional request parameters.

Returns

TypeDescription
ResponseHTTP Response object.

Example

JavaScript
import http from 'k6/http';

const url = 'https://quickpizza.grafana.com/';

export default function () {
  const params = { headers: { 'X-MyHeader': 'k6test' } };
  const res = http.options(url, null, params);
  console.log(res.headers['Allow']);
}