Menu
Open source
patch( url, [body], [params] )
Parameter | Type | Description |
---|---|---|
url | string /HTTP URL | Request URL (e.g. http://example.com ). |
body (optional) | string / object / ArrayBuffer | Request body; objects will be x-www-form-urlencoded . |
params (optional) | object | Params object containing additional request parameters |
Returns
Type | Description |
---|---|
Response | HTTP Response object. |
Example
JavaScript
import http from 'k6/http';
const url = 'https://httpbin.test.k6.io/patch';
export default function () {
const headers = { 'Content-Type': 'application/json' };
const data = { name: 'Bert' };
const res = http.patch(url, JSON.stringify(data), { headers: headers });
console.log(JSON.parse(res.body).json.name);
}
Was this page helpful?
Related documentation
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video
Performance testing and observability in Grafana Cloud
In this webinar, learn how Grafana Cloud k6 offers you the best developer experience for performance testing.
User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.