1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 09:57:01 +00:00

overlap routing: and mvc: allow setting status code from a dependency or a middleware

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-28 04:11:56 +03:00
parent 933534574a
commit a6ec94e1a6
10 changed files with 181 additions and 63 deletions

View File

@@ -176,7 +176,7 @@ func dispatchFuncResult(ctx *context.Context, values []reflect.Value, handler Re
// Except when err != nil then check if status code is < 400 and
// if it's set it as DefaultErrStatusCode.
// Except when found == false, then the status code is 404.
statusCode int
statusCode = ctx.GetStatusCode() // Get the current status code given by any previous middleware.
// if not empty then use that as content type,
// if empty and custom != nil then set it to application/json.
contentType string