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.

Request body middleware

See original GitHub issue

I wanted to make simple REST API with oak but noticed that there is no body field on Request, or worse any way to access underlying ServerRequest’s body. I guess body parsing middleware is missing.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kitsonkcommented, Jan 31, 2019

Closed in 81326b2a1aa292cd1de837841fcb6b6bdfbf4c73

I took a little bit different direction. Instead of a seperate middleware, context.request.body() returns a Promise that will resolve with a parsed body for JSON, URL encoded forms, or text. So basic use cases should just work.

I would like to automagically deal with multi-part forms, but that might be best with seperate middleware, versus baking that into the response. The original net server request is also available publically now which provides the body() and bodyStream() for more advanced use cases.

0reactions
kitsonkcommented, Jul 21, 2021

That API has been significantly update since this issue was closed. What about the current API doesn’t work?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to read the request body in ASP.NET Core Middleware?
Right-click on your project in Solution Explorer and click “Add New Item”. In the search box type “Middleware” and you will see Middleware...
Read more >
Reading request body in middleware for .Net 5 - Stack Overflow
Usually Request.Body does not support rewinding, so it can only be read once. A temp workaround is to pull out the body right...
Read more >
Request and Response operations in ASP.NET Core
Suppose the goal is to create a middleware that reads the entire request body as a list of strings, splitting on new lines....
Read more >
Express body-parser middleware
Returns middleware that parses all bodies as a string and only looks at requests where the Content-Type header matches the type option. This...
Read more >
Read request body multiple times #40635 - dotnet/aspnetcore
Request.EnableBuffering(); // Call the next delegate/middleware in the pipeline await next(context); ...
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