question-mark
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.

Pass through Reader response body type to Deno's HTTP server

See original GitHub issue

Deno’s current Response interface allows Reader as the body type.


/**
 * Interface of HTTP server response.
 * If body is a Reader, response would be chunked.
 * If body is a string, it would be UTF-8 encoded by default.
 */
export interface Response {
  status?: number;
  headers?: Headers;
  body?: Uint8Array | Reader | string;
}

This would be convenient to have in oak since, for example, dejs renders its templates to a Reader.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
kitsonkcommented, May 19, 2020

@dbohdan I think you need to do a --reload. Using your example works for me.

$ curl localhost:3000/reader
Hello, Reader!%                                                                                                         
0reactions
kitsonkcommented, May 19, 2020

(To prevent this sort of confusion maybe you could aggressively version oak like Deno’s std is versioned? I am not actually sure it would be worth it.)

I am/do. I just wanted to try to get as many bug fixes into before cutting a version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A comprehensive guide to HTTP servers in Deno
Response building including setting cookies, headers, different types of bodies (URL encoded, JSON, form data, text, binary, etc.) Saving & ...
Read more >
Response | /http/server.ts | std@0.68.0
Interface of HTTP server response. If body is a Reader, response would be chunked. If body is a string, it would be UTF-8...
Read more >
Deno oak server post body and reponse
"value" on the body is also a promise, try awaiting it: const reqBody = await (await ctx.request.body({ type: 'json' })).value;.
Read more >
Streaming requests with the fetch API - Chrome Developers
This shows how you can stream data from the user to the server, and send data back that can be processed ... const...
Read more >
Second adventure in Deno land 🦕 | learning as we go
If body is a Reader, response would be chunked. If body is a string, it would be UTF-8 encoded by default ...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found