mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-27 06:34:06 +00:00
* feat(): support multipart mixed fix: support vars interpolation on mixed multi-part Update packages/bruno-electron/src/ipc/network/interpolate-vars.js Co-authored-by: Timon <39559178+Its-treason@users.noreply.github.com> refactor: use startsWith feat: best effort for other multipart/* contentypes * feat: enhance variable interpolation for multipart requests - Updated `interpolateVars` function to support interpolation in multipart/form-data and multipart/mixed requests. - Added handling for empty multipart arrays and parts with missing or undefined values. - Improved type checks for content types to ensure proper interpolation behavior. Includes new tests to validate the interpolation functionality for multipart requests. * fix: normalize error handling in sendRequest and improve test reliability --------- Co-authored-by: Alfonso Presa <alfonso-presa@users.noreply.github.com>
46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
meta {
|
|
name: getCookie
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
get {
|
|
url: {{host}}/ping
|
|
body: none
|
|
auth: inherit
|
|
}
|
|
|
|
script:pre-request {
|
|
const jar = bru.cookies.jar()
|
|
|
|
jar.setCookie("https://testbench-sanity.usebruno.com", "name", "value")
|
|
}
|
|
|
|
tests {
|
|
const jar = bru.cookies.jar()
|
|
// Await so the callback runs before jar.clear() below; otherwise the test script can finish
|
|
// before the callback registers/runs the test, causing a flaky failure (e.g. in CI).
|
|
await jar.getCookie("https://testbench-sanity.usebruno.com", "name", function(error, data) {
|
|
if(error) {
|
|
console.error("Cookie retrieval error:", error)
|
|
throw new Error(`Failed to get cookie: ${error.message || error}`)
|
|
}
|
|
|
|
test("should successfully retrieve cookie data", function() {
|
|
expect(data).to.have.property('key');
|
|
expect(data).to.have.property('value');
|
|
expect(data.key).to.equal("name");
|
|
expect(data.value).to.be.a('string');
|
|
expect(data.value).to.not.be.empty;
|
|
expect(data.domain).to.include('usebruno.com');
|
|
console.log("Retrieved cookie:", data);
|
|
});
|
|
})
|
|
|
|
jar.clear()
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
}
|