node-red: RequestError: Parse Error: Missing expected CR after header value

Current Behavior

When doing a simple GET request with no payload to an endpoint that should return a binary buffer (an image) I get the following error:

RequestError: Parse Error: Missing expected CR after header value

The node was working before version 3. Maybe it is related to https://github.com/nodejs/node/issues/43798

Expected Behavior

Return a binary buffer.

Steps To Reproduce

This is the node:

[
    {
        "id": "912ff074.7418",
        "type": "http request",
        "z": "61690af24820e126",
        "name": "",
        "method": "GET",
        "ret": "bin",
        "paytoqs": "ignore",
        "url": "http://192.168.7.14:8023/snapshot.cgi",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "credentials": {},
        "x": 250,
        "y": 40,
        "wires": [
            [
                "bad44d5a.892d3"
            ]
        ]
    }
]

Example flow

[
    {
        "id": "469f2259.87ca3c",
        "type": "inject",
        "z": "61690af24820e126",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 120,
        "wires": [
            [
                "912ff074.7418"
            ]
        ]
    },
    {
        "id": "912ff074.7418",
        "type": "http request",
        "z": "61690af24820e126",
        "name": "",
        "method": "GET",
        "ret": "bin",
        "paytoqs": "ignore",
        "url": "http://192.168.7.14:8023/snapshot.cgi",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "credentials": {},
        "x": 250,
        "y": 40,
        "wires": [
            [
                "bad44d5a.892d3"
            ]
        ]
    }
]

Environment

  • Node-RED version: v3.0.0
  • Node.js version: 16.16.0
  • npm version: -
  • Platform/OS: Docker
  • Browser: Chrome

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 32 (19 by maintainers)

Commits related to this issue

Most upvoted comments

Add the following at line 89 in the http-request.js file

this.insecureHTTPParser = n.insecureHTTPParser