fetch icon indicating copy to clipboard operation
fetch copied to clipboard

fix: ignore not throw on invalid response headers

Open pke opened this issue 3 years ago • 3 comments

@JakeChampion I think the fix is fine, however I struggle with the test. It runs into the same problem that the response headers are validated. But I can't figure out which package supplies this code. None of the node_modules has a _http_outgoing.js that I could monkey-patch for this one response to not validate the response headers.

I also can't just test parseHeaders() since its private and not globally exported (rightfully so).

So do you have any idea how to test my fix properly?

Fixes #930

pke avatar Apr 14 '21 00:04 pke

_http_outgoing.js is part of the built-in NodeJS http module, it is not possible to set a response header name in an invalid format with the built-in NodeJS http module.

The only way I can think to test this, would be to use another language to create a http server which can set a response header name in an invalid format. From the issue, we know that golang is able to do that.

I'm also happy to accept this pull-request without a test

JakeChampion avatar Apr 14 '21 10:04 JakeChampion

I’m working on mocking xhr to Test this.

pke avatar May 01 '21 08:05 pke

What is going on here? I am working on adding a test with mocked xhr and then put it in "Ready for review". So for the time being no more approvals needed. And please github clean up the spam here, thanks ;)

pke avatar Jun 23 '21 11:06 pke