miniflare
miniflare copied to clipboard
Invalid headers in fetch requests?
I'm trying to fetch data from the Finnish transit API's but they return 500 with Miniflare's fetch. The request headers look a bit odd:

Using node-fetch
for example works fine, and the headers look normal:

This should reproduce the problem:
export default {
async fetch(req, res) {
const body = {
query:
"query StopQuery($id: String!) {\n stop(id: $id) {\n name\n stoptimesWithoutPatterns {\n scheduledArrival\n realtimeArrival\n arrivalDelay\n scheduledDeparture\n realtimeDeparture\n departureDelay\n realtime\n realtimeState\n serviceDay\n headsign\n }\n }\n}",
variables: { id: "HSL:2214603" },
operationName: "StopQuery",
};
return await fetch(
"https://api.digitransit.fi/routing/v1/routers/hsl/index/graphql",
{
method: "POST",
body: JSON.stringify(body),
headers: {
"content-type": "application/json",
},
}
);
},
};
Hey! 👋 Apologies for only just getting to this. Which version of Miniflare were you using? Would you be able to try 2.5.0
?
Hey! 👋 We haven't heard from you for a while, so I'm going to close this issue. It's likely this was fixed in Miniflare 3, which uses the same workerd
runtime as production, so shouldn't have these behaviour mismatches. I'm going to close this as it's unlikely we'll have time to fix this in Miniflare 2. Our development effort is primarily focused on version 3.