bruno/packages/bruno-tests/collection/scripting/api/req/setBody.bru

47 lines
487 B
Plaintext
Raw Normal View History

meta {
name: setBody
type: http
seq: 10
}
post {
url: {{host}}/api/echo/json
body: json
auth: none
}
auth:basic {
username: asd
password: j
}
auth:bearer {
token:
}
body:json {
{
"hello": "bruno"
}
}
assert {
res.status: eq 200
}
script:pre-request {
req.setBody({
"bruno": "is awesome"
});
}
tests {
test("req.setBody()", function() {
const data = res.getBody();
expect(data).to.eql({
"bruno": "is awesome"
});
});
}