mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-27 09:08:55 +01:00
59 lines
898 B
Plaintext
59 lines
898 B
Plaintext
meta {
|
|
name: runtime vars
|
|
type: http
|
|
seq: 3
|
|
}
|
|
|
|
post {
|
|
url: {{host}}/api/echo/text
|
|
body: text
|
|
auth: none
|
|
}
|
|
|
|
auth:basic {
|
|
username: asd
|
|
password: j
|
|
}
|
|
|
|
auth:bearer {
|
|
token:
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"envVar1": "{{env.var1}}",
|
|
"envVar2": "{{env-var2}}"
|
|
}
|
|
}
|
|
|
|
body:text {
|
|
Hi, I am {{rUser.full_name}},
|
|
I am {{rUser.age}} years old.
|
|
My favorite food is {{rUser.fav-food[0]}} and {{rUser.fav-food[1]}}.
|
|
I like attention: {{rUser.want.attention}}
|
|
}
|
|
|
|
assert {
|
|
res.status: eq 200
|
|
}
|
|
|
|
script:pre-request {
|
|
bru.setVar("rUser", {
|
|
full_name: 'Bruno',
|
|
age: 4,
|
|
'fav-food': ['egg', 'meat'],
|
|
'want.attention': true
|
|
});
|
|
}
|
|
|
|
tests {
|
|
test("should return json", function() {
|
|
const expectedResponse = `Hi, I am Bruno,
|
|
I am 4 years old.
|
|
My favorite food is egg and meat.
|
|
I like attention: true`;
|
|
expect(res.getBody()).to.equal(expectedResponse);
|
|
});
|
|
|
|
}
|