Files
bruno/packages/bruno-tests/collection/scripting/api/res/setBody/undefined.bru

37 lines
963 B
Plaintext

meta {
name: undefined
type: http
seq: 7
}
post {
url: {{host}}/api/echo/json
body: json
auth: none
}
body:json {
{
"hello": "bruno"
}
}
assert {
res.status: eq 200
}
script:post-response {
// if undefined is not passed to res.setBody() the test fails in only safe-mode, needs to check, undefined is not a valid JSON
// Safe mode, Dev mode behaves differently, null is getting converted to undefined, although both have null in the response, tests with undefined fails in safe mode, this needs to be investigated, undefined is not a valid JSON
res.setBody(undefined)
}
tests {
test("res.setBody(undefined)", function() {
const body = res.getBody();
// Safe mode, Dev mode behaves differently, null is getting converted to undefined, although both have null in the response, tests with undefined fails in safe mode, this needs to be investigated, undefined is not a valid JSON
expect(body).to.be.undefined;
});
}