Fix an instance of setting response headers after they were sent.

This commit is contained in:
Jordan Bancino 2022-12-14 15:02:10 +00:00
parent 708a840ec0
commit e7e25cade5

View file

@ -125,15 +125,15 @@ MatrixHttpHandler(HttpServerContext * context, void *argp)
Free(pathPart);
HttpSendHeaders(context);
if (!response)
{
Log(lc, LOG_WARNING, "A route handler returned NULL.");
Log(lc, LOG_ERR, "A route handler returned NULL.");
HttpResponseStatus(context, HTTP_INTERNAL_SERVER_ERROR);
response = MatrixErrorCreate(M_UNKNOWN);
}
HttpSendHeaders(context);
stream = HttpStream(context);
JsonEncode(response, stream);
fprintf(stream, "\n");