Hi!
Currently I am setting the options of k6 to discard response bodies:
export const options = {
discardResponseBodies: true,
scenarios: {},
};
But I have a specific endpoint that I need the body, I’m trying to use the Params.responseType = ‘text’, but I keep getting null.
let scenarios = {
createUser: {
executor: 'per-vu-iterations',
exec: 'createUser',
vus: 2,
iterations: 1,
startTime: '1s'
}
};
export const options = {
discardResponseBodies: true,
scenarios: {},
};
if (__ENV.scenario) {
options.scenarios[__ENV.scenario] = scenarios[__ENV.scenario];
} else {
options.scenarios = scenarios;
}
export function createUser() {
let body = {
'cpf': '1111111',
}
const response = http.post('https://...', JSON.stringify(body), {headers: {
'Content-Type': 'application/json',
}}, {
responseType: "text",
});
console.log('test', response.status, response.body)
}