Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting a plain Deno Request object from an OpineRequest?

See original GitHub issue

Issue Description

Any 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:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

cmortencommented, Jan 10, 2022

I’ll try have a bit of a look later (work busy today!) - appreciate the investigation so far 🙌

xyzshantaramcommented, Jan 10, 2022

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 a Response with a code outside the range [200,599]).

Run the server with:

deno run --allow-read --allow-net

And there’s a basic client that you can run with:

deno run --allow-read --allow-net

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

opine/ 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.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found