diff --git a/packages/nodes-base/nodes/HttpRequest/test/encodingQuoted/HttpRequest.test.ts b/packages/nodes-base/nodes/HttpRequest/test/encodingQuoted/HttpRequest.test.ts new file mode 100644 index 0000000000..0b96c4b4d0 --- /dev/null +++ b/packages/nodes-base/nodes/HttpRequest/test/encodingQuoted/HttpRequest.test.ts @@ -0,0 +1,40 @@ +import nock from 'nock'; +import { + setup, + equalityTest, + workflowToTests, + getWorkflowFilenames, + initBinaryDataService, +} from '@test/nodes/Helpers'; + +describe('Test Quoted Response Encoding', () => { + const workflows = getWorkflowFilenames(__dirname); + const tests = workflowToTests(workflows); + + const baseUrl = 'https://dummy.domain'; + const payload = Buffer.from( + 'El rápido zorro marrón salta sobre el perro perezoso. ¡Qué bello día en París! Árbol, cañón, façade.', + 'latin1', + ); + + beforeAll(async () => { + await initBinaryDataService(); + + nock.disableNetConnect(); + + nock(baseUrl) + .persist() + .get('/index.html') + .reply(200, payload, { 'content-type': 'text/plain; charset="latin1"' }); + }); + + afterAll(() => { + nock.restore(); + }); + + const nodeTypes = setup(tests); + + for (const testData of tests) { + test(testData.description, async () => await equalityTest(testData, nodeTypes)); + } +}); diff --git a/packages/nodes-base/nodes/HttpRequest/test/encodingQuoted/encodingQuoted.test.json b/packages/nodes-base/nodes/HttpRequest/test/encodingQuoted/encodingQuoted.test.json new file mode 100644 index 0000000000..ac2a083cd4 --- /dev/null +++ b/packages/nodes-base/nodes/HttpRequest/test/encodingQuoted/encodingQuoted.test.json @@ -0,0 +1,69 @@ +{ + "name": "Response Encoding Test", + "nodes": [ + { + "parameters": {}, + "name": "When clicking \"Execute Workflow\"", + "type": "n8n-nodes-base.manualTrigger", + "typeVersion": 1, + "position": [180, 820], + "id": "635fb102-a760-4b9e-836c-82e71bba7974" + }, + { + "parameters": { + "url": "https://dummy.domain/index.html", + "options": {} + }, + "name": "HTTP Request (v3)", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 3, + "position": [520, 720], + "id": "eb243cfd-fbd6-41ef-935d-4ea98617355f" + }, + { + "parameters": { + "url": "https://dummy.domain/index.html", + "options": {} + }, + "name": "HTTP Request (v4)", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4, + "position": [520, 920], + "id": "cc2f185d-df6a-4fa3-b7f4-29f0dbad0f9b" + } + ], + "connections": { + "When clicking \"Execute Workflow\"": { + "main": [ + [ + { + "node": "HTTP Request (v3)", + "type": "main", + "index": 0 + }, + { + "node": "HTTP Request (v4)", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "pinData": { + "HTTP Request (v3)": [ + { + "json": { + "data": "El rápido zorro marrón salta sobre el perro perezoso. ¡Qué bello día en París! Árbol, cañón, façade." + } + } + ], + "HTTP Request (v4)": [ + { + "json": { + "data": "El rápido zorro marrón salta sobre el perro perezoso. ¡Qué bello día en París! Árbol, cañón, façade." + } + } + ] + } +} diff --git a/packages/nodes-base/nodes/HttpRequest/test/node/HttpRequestV3.test.ts b/packages/nodes-base/nodes/HttpRequest/test/node/HttpRequestV3.test.ts index d245c77e7f..b15da2ba2e 100644 --- a/packages/nodes-base/nodes/HttpRequest/test/node/HttpRequestV3.test.ts +++ b/packages/nodes-base/nodes/HttpRequest/test/node/HttpRequestV3.test.ts @@ -182,7 +182,7 @@ describe('HttpRequestV3', () => { ]; it.each(authenticationTypes)( - 'should handle %s authentication', + 'should handle $genericCredentialType authentication', async ({ genericCredentialType, credentials, authField, authValue }) => { (executeFunctions.getInputData as jest.Mock).mockReturnValue([{ json: {} }]); (executeFunctions.getNodeParameter as jest.Mock).mockImplementation((paramName: string) => {