mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-27 14:44:07 +00:00
fix: filter out internal content-type headers for no body requests in axiosinstance (#5591)
* fix: filter out internal content-type headers for no body requests in axios instance
This commit is contained in:
@@ -126,7 +126,13 @@ function makeAxiosInstance({
|
||||
type: 'request',
|
||||
message: `${config.method.toUpperCase()} ${config.url}`,
|
||||
});
|
||||
|
||||
Object.entries(config.headers).forEach(([key, value]) => {
|
||||
// Skip Bruno's internal content-type: false for no body requests
|
||||
if (key.toLowerCase() === 'content-type' && value === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
timeline.push({
|
||||
timestamp: new Date(),
|
||||
type: 'requestHeader',
|
||||
|
||||
@@ -613,10 +613,19 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
);
|
||||
|
||||
const { data: requestData, dataBuffer: requestDataBuffer } = parseDataFromRequest(request);
|
||||
|
||||
// Remove false Content-Type header (used to stop axios from auto-setting it); no Content-Type was actually set or sent.
|
||||
const headersSent = { ...request.headers };
|
||||
Object.keys(headersSent).forEach((key) => {
|
||||
if (key.toLowerCase() === 'content-type' && headersSent[key] === false) {
|
||||
delete headersSent[key];
|
||||
}
|
||||
});
|
||||
|
||||
let requestSent = {
|
||||
url: request.url,
|
||||
method: request.method,
|
||||
headers: request.headers,
|
||||
headers: headersSent,
|
||||
data: requestData,
|
||||
dataBuffer: requestDataBuffer
|
||||
}
|
||||
@@ -1090,10 +1099,19 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
}
|
||||
|
||||
const { data: requestData, dataBuffer: requestDataBuffer } = parseDataFromRequest(request);
|
||||
|
||||
// Remove false Content-Type header (used to stop axios from auto-setting it); no Content-Type was actually set or sent.
|
||||
const headersSent = { ...request.headers };
|
||||
Object.keys(headersSent).forEach((key) => {
|
||||
if (key.toLowerCase() === 'content-type' && headersSent[key] === false) {
|
||||
delete headersSent[key];
|
||||
}
|
||||
});
|
||||
|
||||
let requestSent = {
|
||||
url: request.url,
|
||||
method: request.method,
|
||||
headers: request.headers,
|
||||
headers: headersSent,
|
||||
data: requestData,
|
||||
dataBuffer: requestDataBuffer
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user