mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-08 14:35:03 +00:00
fix: preserve stream-backed file bodies during request interpolation (#7690)
This commit is contained in:
committed by
GitHub
parent
f8bf1460bd
commit
975c638f39
@@ -1,6 +1,25 @@
|
||||
const { describe, it, expect } = require('@jest/globals');
|
||||
const interpolateVars = require('../../src/runner/interpolate-vars');
|
||||
|
||||
describe('interpolate-vars: interpolateVars', () => {
|
||||
it('keeps stream-backed JSON request bodies intact', () => {
|
||||
const streamPayload = {
|
||||
pipe: jest.fn(),
|
||||
path: '/tmp/allocations.json'
|
||||
};
|
||||
const request = {
|
||||
method: 'POST',
|
||||
mode: 'file',
|
||||
url: 'http://api.example/upload',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
data: streamPayload
|
||||
};
|
||||
|
||||
const result = interpolateVars(request, { shouldNotApply: 'value' }, null, null);
|
||||
expect(result.data).toBe(streamPayload);
|
||||
});
|
||||
});
|
||||
|
||||
describe('interpolate-vars: api key header name sidecar', () => {
|
||||
it('interpolates apiKeyHeaderName in lockstep with interpolated header keys', () => {
|
||||
const request = {
|
||||
|
||||
Reference in New Issue
Block a user