You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've skimmed through the server code and don't see anything that might be causing this, and when debug is enable the console reports that the response data is there, so I'm thoroughly stumped about the problem.
The example below should take a status code in the request body and echo it back to you using that status code for the response. For some status codes (e.g. 409 conflict) Postman reports that it gets nothing in the response body, and it's missing all of the headers that should normally be there (Access-Control-Allow-Origin, Content-Length, and Content-Type).
internal class Program
{
public static void Main(string[] args)
{
var server = new Server("localhost", 8080, false, Handler, true);
Console.ReadKey();
server.Dispose();
}
private static HttpResponse Handler(HttpRequest request)
{
var bodyData = request.Data ?? new byte[0];
var bodyString = Encoding.UTF8.GetString(bodyData);
int statusCode;
if (!int.TryParse(bodyString, out statusCode))
statusCode = 404;
return new HttpResponse(request, true, statusCode, null, "text/plain", bodyString, true);
}
}
The text was updated successfully, but these errors were encountered:
Hi @mbcrawfo it looks like this is the behavior anytime a status code is used that isn't accounted for in BuildErrorResponse and SendResponse. I tried with 200, 201, 400, 404, etc, and they returned the correct headers. Can you confirm that is the case? If so, I can add 409 an any other status codes you wish to use that I may have missed. Thanks!
I've skimmed through the server code and don't see anything that might be causing this, and when debug is enable the console reports that the response data is there, so I'm thoroughly stumped about the problem.
The example below should take a status code in the request body and echo it back to you using that status code for the response. For some status codes (e.g. 409 conflict) Postman reports that it gets nothing in the response body, and it's missing all of the headers that should normally be there (Access-Control-Allow-Origin, Content-Length, and Content-Type).
The text was updated successfully, but these errors were encountered: