Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using useElectronNet results in error: HTTP trailers are not supported #461

Closed
wwwouter opened this issue Feb 23, 2018 · 3 comments
Closed
Labels
bug Something does not work as it should external The issue related to an external project

Comments

@wwwouter
Copy link
Contributor

I'm using this code to upload a file to S3:

const response = await got.put(urlString, {
      body: fs.readFileSync(filename),
      useElectronNet: true,
    });

And this throws an uncaughtException "HTTP trailers are not supported"

This because the response is parsed by mimic-response: mimicResponse(res, progressStream);
and mimic-response uses a knownProps array to read values from the IncomingMessage.
knownProps props contains 'trailers' and 'rawTrailers'. When these are read from the IncomingMessage, this throws an error because of this code:
https://github.com/electron/electron/blob/1c0ea0286ed7f8fb9075d1a6c03c758c72e965b8/lib/browser/api/net.js#L59

mimic-response should be made aware of that it is using electron.net or got should do something to prevent the reading of these properties.

If you let me know what you'd prefer, I can make a pull request 😄

@wwwouter wwwouter changed the title Use useElectronNet results in error: HTTP trailers are not supported. Using useElectronNet results in error: HTTP trailers are not supported. Feb 23, 2018
@sindresorhus
Copy link
Owner

I think it would be more appropriate to remove the useElectronNet option altogether. The Electron implementation is far from compatible and they're not really fixing any of the issues. It sounded promising when I first added it, but it's only been a headache since then.

@wwwouter
Copy link
Contributor Author

That would be too bad, because for us the combination of got and electron works perfectly, except for this error...

Would it be possible to wrap electron support in a provider and keep it out of the got codebase, but still be available for people who want to use it at their own peril?

@sindresorhus
Copy link
Owner

sindresorhus commented Jul 5, 2018

@wwwouter I'll keep it in Got for now. The best you could do is open Electron issues with test cases on the Electron issue tracker for any issue you encounter, and also paste the link to the issue here. These issues have to be fixed there.

@sindresorhus sindresorhus added bug Something does not work as it should external The issue related to an external project labels Jul 5, 2018
@sindresorhus sindresorhus changed the title Using useElectronNet results in error: HTTP trailers are not supported. Using useElectronNet results in error: HTTP trailers are not supported Jul 5, 2018
Echo-Peak added a commit to cyber-smart/electron-pdf-window that referenced this issue Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something does not work as it should external The issue related to an external project
Projects
None yet
Development

No branches or pull requests

2 participants