fix: allow empty header names in CLI and gRPC request preparation (#7925)

This commit is contained in:
Pragadesh-45
2026-05-06 18:52:16 +05:30
committed by GitHub
parent 39f8c68124
commit 50d3862ea3
3 changed files with 4 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ const prepareRequest = async (item = {}, collection = {}) => {
const disabledHeaders = [];
each(get(request, 'headers', []), (h) => {
if (h.enabled && h.name.length > 0) {
if (h.enabled && h.name?.length > 0) {
headers[h.name] = h.value;
if (h.name.toLowerCase() === 'content-type') {
contentTypeDefined = true;

View File

@@ -137,7 +137,7 @@ const prepareGrpcRequest = async (item, collection, environment, runtimeVariable
}
each(get(request, 'headers', []), (h) => {
if (h.enabled && h.name.length > 0) {
if (h.enabled && h.name?.length > 0) {
headers[h.name] = h.value;
}
});

View File

@@ -381,12 +381,12 @@ const prepareRequest = async (item, collection = {}, abortController) => {
const disabledHeaders = [];
each(get(request, 'headers', []), (h) => {
if (h.enabled && h.name.length > 0) {
if (h.enabled && h.name?.length > 0) {
headers[h.name] = h.value;
if (h.name.toLowerCase() === 'content-type') {
contentTypeDefined = true;
}
} else if (!h.enabled && h.name.length > 0) {
} else if (!h.enabled && h.name?.length > 0) {
disabledHeaders.push({ name: h.name, value: h.value });
}
});