-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
The application completed without reading the entire request body. #7
Comments
Hi @chuksgpfr , You'll have to provide more information:
|
|
@chuksgpfr , you might want to call using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Mvc;
namespace FooBar.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ValuesController : ControllerBase
{
// POST api/values
[HttpPost]
public async Task<ActionResult> Post()
{
this.Request.EnableRewind(); // <-- This is very important
var body = this.Request.Body;
body.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(body))
{
var payload = await reader.ReadToEndAsync();
return Ok(payload);
}
}
}
} Reference: #1 |
Hi @chuksgpfr , I hope my last post help you solve your issue. If you have any other questions, feel free to continue posting here. For now, I'm going to close the issue. Thanks again for asking your question. -Brian |
Hi @bchavez I'm sorry for the late reply, SCHOOL ISSUES... While sending a test webhook from coinbase, i'm still getting 500 internal server error... Please can u create an actual project and try. This will be very helpful to me. Thanks.. PS: I'm testing locally using ngrok. Thanks. Coinbase Shows "Remote server at 6f7d068b.ngrok.io returned an HTTP 502" while ngrok shows no error using https |
Thanks man..... Just fixed it. |
Quick question...
|
Hi @chuksgpfr , The HTTP body of the webhook should contain something. You'll need to read the body into the
Again, don't forget to Also, you'll have to examine the ngrok Web Interface to look at more details of the webhook payload that is hitting your endpoint for the exact HTTP payload details of what was sent to you. From these, it should be clear after examining the breakpoint on the Additionally, Lastly, I want to help with friendly advice: please remember, anytime you have an issue with code and you have to report an issue to a person who is not next to you (like over the Internet), please always remember that the other person doesn't have access to your computer and it is very hard for the other person to get an idea of what your problem is without being next to you to help you. It's very difficult for everyone to provide help over the Internet just by writing text. 😢 So, here are some helpful tips to make the process more successful for everyone: When reporting an issue to someone --
The more things you can provide about the problem, the more successful we will all be in helping you resolve those issues. |
Request.Body.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(Request.Body)) { var json =await reader.ReadToEndAsync(); }
when testing my webhook, it throws 500 internal server error. and then in my server i see this error "The application completed without reading the entire request body."
The text was updated successfully, but these errors were encountered: