Skip to content

different requestHeaders between pretender / msw #21

@Techn1x

Description

@Techn1x

Just wondering why we lowercase the requestHeaders here in our MSW interceptor?

requestHeaders[k.toLowerCase()] = v;

Under pretender, they would come through exactly as they were requested

fetch('/my-url', { headers: { Authorization: 'valid', CrAzYkeY: true } })

It's of course an easy fix in my code, but it's a small hurdle to this mirage-msw package being a drop-in replacement for pretender

server.get('/my-url/**', function (_, request) {
-    return request.requestHeaders.Authorization === 'valid' && request.requestHeaders.CrAzYkeY
+    return request.requestHeaders.authorization === 'valid' && request.requestHeaders.crazykey
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions