Skip to content

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

@wwwouter

Description

@wwwouter

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 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething does not work as it shouldexternalThe issue related to an external project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions