mswjs / interceptors

Low-level network interception library.
https://npm.im/@mswjs/interceptors
MIT License
539 stars 123 forks source link

Header keys for requests are being converted to lowercase #502

Closed mdesousa closed 3 months ago

mdesousa commented 8 months ago

Hi, thanks for this great library!

We had a question about the behavior for intercepted requests. We noticed that the header keys are being converted to lowercase, but we didn't make any changes to them in our interceptors. Is this something that is expected? We are initializing the interceptor as shown below, and the request interceptor is just logging the request without touching it. On the receiving end, we are noticing that the header keys are now lowercase. Thanks.

  const interceptor = new BatchInterceptor({
    name: 'my-interceptor',
    interceptors: [
      new ClientRequestInterceptor(),
      new XMLHttpRequestInterceptor(),
      new FetchInterceptor(),
    ],
  });
  interceptor.apply();
kettanaito commented 3 months ago

Hi, @mdesousa. Thanks for reporting this.

Could you please share a reproduction repository for this? At the very least, please include how you are making the actual request. I will gladly look into the issue once you do. Thanks.