mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-02 21:03:51 +01:00
41040bc296
Co-authored-by: Anoop M D <anoop.md1421@gmail.com>
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: 5,
|
|
'fav-food': ['egg', 'meat'],
|
|
'want.attention': true
|
|
});
|
|
}
|
|
|
|
tests {
|
|
test("should return json", function() {
|
|
const expectedResponse = `Hi, I am Bruno,
|
|
I am 5 years old.
|
|
My favorite food is egg and meat.
|
|
I like attention: true`;
|
|
expect(res.getBody()).to.equal(expectedResponse);
|
|
});
|
|
|
|
}
|