mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
fix(HTTP Request Node): Tolerate header name being empty (#9138)
This commit is contained in:
@@ -1527,7 +1527,10 @@ export class HttpRequestV3 implements INodeType {
|
|||||||
if (sendHeaders && headerParameters) {
|
if (sendHeaders && headerParameters) {
|
||||||
let additionalHeaders: IDataObject = {};
|
let additionalHeaders: IDataObject = {};
|
||||||
if (specifyHeaders === 'keypair') {
|
if (specifyHeaders === 'keypair') {
|
||||||
additionalHeaders = await reduceAsync(headerParameters, parametersToKeyValue);
|
additionalHeaders = await reduceAsync(
|
||||||
|
headerParameters.filter((header) => header.name),
|
||||||
|
parametersToKeyValue,
|
||||||
|
);
|
||||||
} else if (specifyHeaders === 'json') {
|
} else if (specifyHeaders === 'json') {
|
||||||
// body is specified using JSON
|
// body is specified using JSON
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -59,6 +59,12 @@ describe('Test HTTP Request Node', () => {
|
|||||||
completed: true,
|
completed: true,
|
||||||
userId: 26,
|
userId: 26,
|
||||||
});
|
});
|
||||||
|
nock(baseUrl).get('/todos/1').reply(200, {
|
||||||
|
id: 1,
|
||||||
|
todo: 'Do something nice for someone I care about',
|
||||||
|
completed: true,
|
||||||
|
userId: 26,
|
||||||
|
});
|
||||||
nock(baseUrl).matchHeader('Authorization', 'Bearer 12345').get('/todos/3').reply(200, {
|
nock(baseUrl).matchHeader('Authorization', 'Bearer 12345').get('/todos/3').reply(200, {
|
||||||
id: 3,
|
id: 3,
|
||||||
todo: 'Watch a classic movie',
|
todo: 'Watch a classic movie',
|
||||||
|
|||||||
@@ -1,24 +1,30 @@
|
|||||||
{
|
{
|
||||||
"name": "http request test",
|
"name": "HTTP Request test",
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{
|
{
|
||||||
"parameters": {},
|
"parameters": {},
|
||||||
"id": "12433cfb-74d9-4bf1-9afd-0ab9afc9ef19",
|
"id": "3db51d12-a71b-4d0d-84db-1d4c46454c40",
|
||||||
"name": "When clicking \"Execute Workflow\"",
|
"name": "When clicking \"Execute Workflow\"",
|
||||||
"type": "n8n-nodes-base.manualTrigger",
|
"type": "n8n-nodes-base.manualTrigger",
|
||||||
"typeVersion": 1,
|
"typeVersion": 1,
|
||||||
"position": [820, 360]
|
"position": [
|
||||||
|
160,
|
||||||
|
720
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"url": "https://dummyjson.com/todos/1",
|
"url": "https://dummyjson.com/todos/1",
|
||||||
"options": {}
|
"options": {}
|
||||||
},
|
},
|
||||||
"id": "07670093-862f-403f-96a5-ddf7fdb0d225",
|
"id": "96f38d87-0bdd-420c-b981-26fd55d11cb2",
|
||||||
"name": "HTTP Request",
|
"name": "HTTP Request",
|
||||||
"type": "n8n-nodes-base.httpRequest",
|
"type": "n8n-nodes-base.httpRequest",
|
||||||
"typeVersion": 3,
|
"typeVersion": 3,
|
||||||
"position": [1120, 100]
|
"position": [
|
||||||
|
460,
|
||||||
|
460
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parameters": {
|
"parameters": {
|
||||||
@@ -34,11 +40,14 @@
|
|||||||
},
|
},
|
||||||
"options": {}
|
"options": {}
|
||||||
},
|
},
|
||||||
"id": "25cc4f31-9363-4247-a49d-7ac49f174d16",
|
"id": "85ca0a5b-3ff4-491d-ba51-990fdf2b757f",
|
||||||
"name": "HTTP Request fake header",
|
"name": "HTTP Request fake header",
|
||||||
"type": "n8n-nodes-base.httpRequest",
|
"type": "n8n-nodes-base.httpRequest",
|
||||||
"typeVersion": 3,
|
"typeVersion": 3,
|
||||||
"position": [1120, 440]
|
"position": [
|
||||||
|
460,
|
||||||
|
800
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parameters": {
|
"parameters": {
|
||||||
@@ -58,11 +67,29 @@
|
|||||||
},
|
},
|
||||||
"options": {}
|
"options": {}
|
||||||
},
|
},
|
||||||
"id": "33c80933-b113-4eff-beb7-4a5b0bc30bcf",
|
"id": "68d6e51a-66ea-45bf-928c-55efd2493cf0",
|
||||||
"name": "HTTP Request with query",
|
"name": "HTTP Request with query",
|
||||||
"type": "n8n-nodes-base.httpRequest",
|
"type": "n8n-nodes-base.httpRequest",
|
||||||
"typeVersion": 3,
|
"typeVersion": 3,
|
||||||
"position": [1120, 620]
|
"position": [
|
||||||
|
460,
|
||||||
|
980
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"url": "https://dummyjson.com/todos/1",
|
||||||
|
"sendHeaders": true,
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
"id": "38ec1a50-7f0e-4749-822d-f26370b00694",
|
||||||
|
"name": "HTTP Request empty header",
|
||||||
|
"type": "n8n-nodes-base.httpRequest",
|
||||||
|
"typeVersion": 3,
|
||||||
|
"position": [
|
||||||
|
460,
|
||||||
|
640
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"pinData": {
|
"pinData": {
|
||||||
@@ -108,6 +135,16 @@
|
|||||||
"userId": 4
|
"userId": 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"HTTP Request empty header": [
|
||||||
|
{
|
||||||
|
"json": {
|
||||||
|
"id": 1,
|
||||||
|
"todo": "Do something nice for someone I care about",
|
||||||
|
"completed": true,
|
||||||
|
"userId": 26
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"connections": {
|
"connections": {
|
||||||
@@ -128,17 +165,24 @@
|
|||||||
"node": "HTTP Request fake header",
|
"node": "HTTP Request fake header",
|
||||||
"type": "main",
|
"type": "main",
|
||||||
"index": 0
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"node": "HTTP Request empty header",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active": false,
|
"active": false,
|
||||||
"settings": {},
|
"settings": {
|
||||||
"versionId": "0fb64565-22b3-4ff3-8ba4-354b2bcaf8a6",
|
"executionOrder": "v1"
|
||||||
"id": "108",
|
},
|
||||||
|
"versionId": "",
|
||||||
"meta": {
|
"meta": {
|
||||||
"instanceId": "36203ea1ce3cef713fa25999bd9874ae26b9e4c2c3a90a365f2882a154d031d0"
|
"templateCredsSetupCompleted": true,
|
||||||
|
"instanceId": "27cc9b56542ad45b38725555722c50a1c3fee1670bbb67980558314ee08517c4"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user