fix: preserve stream-backed file bodies during request interpolation (#7690)

This commit is contained in:
Hritam Shrivastava
2026-05-07 14:05:14 +05:30
committed by GitHub
parent f8bf1460bd
commit 975c638f39
4 changed files with 48 additions and 4 deletions

View File

@@ -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 = {