No results for

Powered byAlgolia
⚠️ This is the archived documentation for k6 v0.47. Go to the latest version.

put( 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

import http from 'k6/http';
const url = 'https://httpbin.test.k6.io/put';
export default function () {
const headers = { 'Content-Type': 'application/json' };
const data = { name: 'Bert' };
const res = http.put(url, JSON.stringify(data), { headers: headers });
console.log(JSON.parse(res.body).json.name);
}