Skip to content

Preserve header names #59

Open
Open

Description

@Cooya

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 ?

Activity

  1. Cooya commented on Oct 23, 2021

    @Cooya
    Author

    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'];
          }
        ]
      }
    });
  2. self-assigned this
    on Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions