菜单
文档breadcrumb arrow Grafana k6breadcrumb arrow JavaScript APIbreadcrumb arrow jslibbreadcrumb arrow httpxbreadcrumb arrow trace(url, [body], [params])
开源

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

session.trace(url, body, params) 发起一个 TRACE 请求。只有第一个参数是必需的

参数类型描述
urlstringHTTP URL。如果设置了 baseURL,则仅提供路径。
body (可选)null / string / object / ArrayBuffer / SharedArray请求体;对象将是 x-www-form-urlencoded 格式。设置为 null 可省略请求体。
params (可选)null 或对象 {}此特定请求的附加参数

返回

类型描述
ResponseHTTP Response 对象。

示例

JavaScript
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';

const session = new Httpx({
  baseURL: 'https://quickpizza.grafana.com',
  timeout: 20000, // 20s timeout.
});

export default function testSuite() {
  const resp = session.trace(`/`);
  console.log(resp.status);
}