Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Access request raw body #44

Closed
rracariu opened this issue Mar 17, 2020 · 1 comment
Closed

Feature - Access request raw body #44

rracariu opened this issue Mar 17, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@rracariu
Copy link

Currently there is no way to work with mime types in requests that are not of the hard-coded types.

For example text has only this https://github.com/oakserver/oak/blob/master/request.ts#L26

A rawBody method would help future proof the API so it can used to read raw bytes.

Additionally providing a way to inject different text mime-types would also be good for the safe body method.

@kitsonk kitsonk added the enhancement New feature or request label May 2, 2020
@kitsonk
Copy link
Collaborator

kitsonk commented May 9, 2020

Fixed in a380e12

I did a couple of changes:

  • If the content type does not map to Form, JSON, or Text, then request.body() will resolve with a type of "raw" and a value of Uint8Array.
  • If you do request.body(true) and the it will resolve with type of "reader" and a value of Deno.Reader.
  • If you supply app.bodyContentTypes, they will allow you to add additional media types which can be mapped to the Form, JSON, Text parsing of .body().

@kitsonk kitsonk closed this as completed May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants