Getting a plain Deno Request object from an OpineRequest?
See original GitHub issueAny way to do this? I’d like to use Opine with Deno’s built-in WebSockets functionality.
This calls for doing something like:
const { socket, response } = Deno.upgradeWebSocket(req);
where req
is a Deno Request object. Then we respond with the response
object that the method returns, and use the socket to perform our communications.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
opine/request.md at main · cmorten/opine · GitHub - API
The req object is an enhanced version of Deno's own request object and supports all built-in fields and methods. Properties. req.app.
Read more >HTTP Requests - Deno by Example
To make a request to a server, you use the `fetch` API. let resp ; The response is a `Response` object. This contains...
Read more >Request | Deploy Docs
The resource can either be a request object or a URL string. init, RequestInit, true, The init object lets you set optional parameters...
Read more >Deno: Request body processing in Oak | The JS runtimes
The request object present in the context has an API hasBody, that can be used to find out if a body came in...
Read more >Making Http GET Requests with Deno - Ultimate Courses
Inside of our for..of , we can check each req object coming through and see if the method property contains GET . We...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll try have a bit of a look later (work busy today!) - appreciate the investigation so far 🙌
Made a PoC. It’s not the best that we have to have
wsUpgrade
exposed, but sadly simply copying over the headers and status code didn’t work (I won’t elaborate, but in short you can’t create aResponse
with a code outside the range[200,599]
).Run the server with:
And there’s a basic client that you can run with:
Heads up: The client fails gracelessly if you don’t start the server beforehand.
I’ve only put the changes on my fork for now, but let me know if you want me to make a PR of them.