mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-13 18:21:28 +01:00
753a576c3c
Safe Mode Sandbox using QuickJS Co-authored-by: Anoop M D <anoop.md1421@gmail.com> Co-authored-by: lohit <lohit.jiddimani@gmail.com>
60 lines
863 B
Plaintext
60 lines
863 B
Plaintext
meta {
|
|
name: sum
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
post {
|
|
url: {{host}}/api/echo/json
|
|
body: json
|
|
auth: none
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"a": 1,
|
|
"b": 2
|
|
}
|
|
}
|
|
|
|
assert {
|
|
res.status: eq 200
|
|
}
|
|
|
|
script:pre-request {
|
|
const math = require("./lib/math.js");
|
|
const body = req.getBody();
|
|
body.sum = math.sum(body.a, body.b);
|
|
|
|
req.setBody(body);
|
|
}
|
|
|
|
tests {
|
|
test("should return json", function() {
|
|
const data = res.getBody();
|
|
expect(res.getBody()).to.eql({
|
|
"a": 1,
|
|
"b": 2,
|
|
"sum": 3
|
|
});
|
|
});
|
|
|
|
test("should return json", function() {
|
|
const data = res.getBody();
|
|
expect(res.getBody()).to.eql({
|
|
"a": 1,
|
|
"b": 2,
|
|
"sum": 3
|
|
});
|
|
});
|
|
|
|
test("should return json", function() {
|
|
const data = res.getBody();
|
|
expect(res.getBody()).to.eql({
|
|
"a": 1,
|
|
"b": 2,
|
|
"sum": 3
|
|
});
|
|
});
|
|
}
|