mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-16 04:11:29 +00:00
* feat: introduce `res.getSize()` helper (header/body/total) * fix: unit test * rm: request-duration from collection runner header * change: api for getSize * fix * improve: getSize method * add: todo comment --------- Co-authored-by: lohit <lohit@usebruno.com>
37 lines
644 B
Plaintext
37 lines
644 B
Plaintext
meta {
|
|
name: getSize
|
|
type: http
|
|
seq: 8
|
|
}
|
|
|
|
get {
|
|
url: https://www.httpfaker.org/api/random/json?size=1mb
|
|
body: none
|
|
auth: inherit
|
|
}
|
|
|
|
params:query {
|
|
size: 1mb
|
|
}
|
|
|
|
script:post-response {
|
|
console.log(res.getSize())
|
|
}
|
|
|
|
tests {
|
|
test("test body size", function() {
|
|
const bodySize = res.getSize().body;
|
|
expect(bodySize === 1048934).to.be.true;
|
|
});
|
|
|
|
test("test header size", function() {
|
|
const bodySize = res.getSize().header;
|
|
expect(bodySize === 305).to.be.true;
|
|
});
|
|
|
|
test("test total size", function() {
|
|
const sizes = res.getSize();
|
|
expect(sizes.total).to.equal(sizes.header + sizes.body);
|
|
});
|
|
}
|