Can not return customize Http Status code.
Can not return customize Http Status code.
I have to return customize Http Status code like 11, 22, 99... but I catch Error: read ECONNRESET
Code and Issue
public IActionResult MyMethod()
{
return StatusCode(99);
}
When I use Postman call, result return:
Could not get any response There was an error connecting to http://localhost:4015/api/values/5. Why this might have happened: The server couldn't send a response: Ensure that the backend is working properly Self-signed SSL certificates are being blocked: Fix this by turning off 'SSL certificate verification' in Settings > General Proxy configured incorrectly Ensure that proxy is configured correctly in Settings > Proxy Request timeout: Change request timeout in Settings > General
Postman console show Error:
Error: read ECONNRESET
Please show me how to do this.
In .net framework I can perform like: return Content((StatusCode)99, myObject);
@ngoctubk does this happen if you return a standard status code such as 200? Or only with the non-standard ones?
Tagging @Tratcher in case you've seen something like this...
@Eilon It's OK with standard status code when I'm using:
- return NoContent();
- return OK(object);
- return CreatedAtAction(...) .... I't only happen when I use StatusCode() with non-standard one.
Values less than 100 are invalid. Where are you getting those?
Oh, I don't know that values less than 100 are invalid. Thank you!