There’s a bug in the fetch/Request implementation. When the request body is an instance of URLSearchParams the request’s content-type header should automatically be set to “application/x-www-form-urlencoded”
https://fetch.spec.whatwg.org/#request-create
To reproduce, try this code in a browser vs in a worker.
const r = new Request('https://example.com/', {
method: 'POST',
body: new URLSearchParams({ hello: 'world' })
});
console.log(r.headers.get('content-type'));
// expected: application/x-www-form-urlencoded;charset=UTF-8
// actual: text/plain;charset=UTF-8