I need to make an HTTP request to a service that returns malformed headers that the native Node.js parser can’t handle. In a test script, I’ve found that I can use the
http-parser-js library to make the same request and it handles the bad headers gracefully.
Now I need to make that work within the Electron app that needs to actually make the call and retrieve the data and it’s failing with the same
HPE_INVALID_HEADER_TOKEN. I assume, for that reason, that the native HTTP parser is not getting overridden.
In my electron app, I have the same code I used in my test script:
process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser; var http = require('http'); var req = http.request( ... )
Is there an alternate process binding syntax I can use within Electron?