RequestError: Parse Error: Missing expected CR after header value

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:31 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
hardillbcommented, Aug 14, 2022

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

this.insecureHTTPParser = n.insecureHTTPParser
0reactions
alexbn71commented, Aug 14, 2022

Yes @hardillb I know this. But in my case it’s an IP Cam and I have no chance to resolve the issue on that side. Also it always worked with nodered 2.x and therefore I would like to have it working again… it’s a small hope that it will still work in the future. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parse Error: Missing expected CR after header value
Hello, Anyone knows what could cause this? This only happens to a specific vendor after upgrading from previous version to 1.2.8/1.2.9?
Read more >
HTTP Request Node Error - Questions - n8n community
I try with HTTP Request Node to make a simple GET request but it fails with the following error. { "status": "rejected", "reason":...
Read more >
NodeJS, how to debug Parse Error at TLSSocket ...
I've tried using the response module instead of the core https libraries in node but I still get the same underlying error. I'm...
Read more >
RequestError: Parse Error: Invalid header value char #1685
it is expected to return the response from the requested url, It was working before and all of a sudden it's not. Checklist....
Read more >
HTTP/1.1, part 1: URIs, Connections, and Message Parsing
Header Field Registration ... Many HTTP/1.1 header field values consist of words (token or ... the response MUST be a 400 (Bad Request)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found