菜单
文档breadcrumb arrow Grafana k6breadcrumb arrow JavaScript APIbreadcrumb arrow k6/httpbreadcrumb arrow options( url, [body], [params] )
开源

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

参数类型描述
urlstring / HTTP URL请求 URL (例如 http://example.com)。
body (可选)string / object / ArrayBuffer请求体;对象将使用 x-www-form-urlencoded 进行编码。
params (可选)object包含额外请求参数的 Params 对象。

返回值

类型描述
ResponseHTTP Response 对象。

示例

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']);
}