let req3 = {
method: 'POST',
url: `http://localhost:8080/xcx/common/addSurvey`,
body: {
id: '',
userIdentity: 'dasdsa',
userName: 'sada',
userPhone: 'sadasd',
userSuggest: 'sadccc'
},
params: {
headers: {
// 'Content-Type': 'application/x-www-form-urlencoded'
'Content-Type': 'application/json'
},
},
}
let responses = http.batch([req3]);
check(responses[0], {
'main page status was 200': res => res.status == 200,
// 'main page status was 200': r => (r.body)['message'] == 'OK',
});
Hi @wuyuebiu,
Your script seems to work perfectly for me.
What exactly are you seeing that you think is not right and what is the output of k6 version
?
I think the json in the body , it’s not json.stringify , and I don’t know what the problem is
I use post request , it’s all right , but batch not
I would expect a POST to return 201 and not 200.
You can use console.log(JSON.stringify(responses,nil, " ")
to print out the responses and see what is being returned (the nil, " "
parts are so it is better formatted