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

Preserve header names #59

Open
Cooya opened this issue Oct 23, 2021 · 1 comment
Open

Preserve header names #59

Cooya opened this issue Oct 23, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request.

Comments

@Cooya
Copy link

Cooya commented Oct 23, 2021

I am sending requests to a server which does not respect HTTP specification specifying that headers should be case-insensitive.
The problem is that with got-scraping, a header named "MyHeader" will be renamed "Myheader"...

How can I send a header whose name will be kept untouched ?

@Cooya
Copy link
Author

Cooya commented Oct 23, 2021

I tried using a hook without success :

let { gotScraping } = require('got-scraping');

gotScraping = gotScraping.extend({
  hooks: {
    beforeRequest: [
      options => {
        options.headers['myheader'] = options.headers['MyHeader'];
        delete options.headers['myheader'];
      }
    ]
  }
});

@szmarczak szmarczak added the enhancement New feature or request. label Dec 31, 2021
@szmarczak szmarczak self-assigned this Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants