How to modify websocket request before sending it to durable object

I currently call:
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?
Was this page helpful?