import http from 'k6/http';
const url = 'https://httpbin.test.k6.io/post';
const logoBin = open('./logo.png', 'b');
export default function () {
let data = { name: 'Bert' };
let res = http.post(url, JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
console.log(res.json().json.name);
res = http.post(url, data);
console.log(res.json().form.name);
http.post(url, logoBin, { headers: { 'Content-Type': 'image/png' } });
data = new Uint8Array([104, 101, 108, 108, 111]);
http.post(url, data.buffer, { headers: { 'Content-Type': 'image/png' } });
}