However, in my case, request.headers is a HeadersInit object and it didn't seem like the spread operator was working correctly over that object (as a concrete example, I no longer had Content-Type: application/json going out on my requests...)
Ideas / Proposed Solution(s)
I was able to fix the issue by doing the following:
It seems like the spread operator works just fine over this oldHeaders object and all the expected headers now show up in my requests (Content-Type: application/json, etc)
Perceived Problem
The middleware docs (https://github.com/graffle-js/graffle/blob/graphql-request/examples/other-middleware.ts) propose that we do the following if we want to add a custom header
However, in my case,
request.headers
is aHeadersInit
object and it didn't seem like the spread operator was working correctly over that object (as a concrete example, I no longer hadContent-Type: application/json
going out on my requests...)Ideas / Proposed Solution(s)
I was able to fix the issue by doing the following:
It seems like the spread operator works just fine over this
oldHeaders
object and all the expected headers now show up in my requests (Content-Type: application/json
, etc)