del( url, [body], [params] )
发出一个 DELETE 请求。
参数 | 类型 | 描述 |
---|---|---|
url | string / HTTP URL | 请求 URL(例如 http://example.com )。 |
body(可选,不推荐) | string / object / ArrayBuffer | 请求体;对象将被编码为 x-www-form-urlencoded 。不推荐发送带请求体的 DELETE 请求,因为其没有明确定义的语义,可能导致某些服务器拒绝该请求。 |
params(可选) | object | 包含附加请求参数的Params 对象。 |
返回
类型 | 描述 |
---|---|
Response | HTTP Response 对象。 |
示例
import http from 'k6/http';
const url = 'https://quickpizza.grafana.com/api/delete';
export default function () {
const params = { headers: { 'X-MyHeader': 'k6test' } };
http.del(url, null, params);
}