How to modify websocket request before sending it to durable object
I currently call:
but I want to send it like this:
Where the modifiedRequest is as follows:
When I try this I get:
What am I missing?
durableObject.fetch(request)
but I want to send it like this:
durableObject.fetch(modifiedRequest)
Where the modifiedRequest is as follows:
let url = new URL(request.url);
url.searchParams.append('test', 'test123');
let modifiedRequest = new Request(url, {
...request,
});
When I try this I get:
Worker tried to return a WebSocket in a response to a request which did not contain the header "Upgrade: websocket"."
What am I missing?