Browse Source

Header wasn't being written in all cases.

master
Benjamin Shelton 4 weeks ago
parent
commit
2fcb489899
1 changed files with 2 additions and 5 deletions
  1. +2
    -5
      route.go

+ 2
- 5
route.go View File

@@ -331,7 +331,6 @@ ERRTYPES:
if ctx.Code() >= 400 {
rt.router.HTTPError(ctx)
}
return
case *ce.Redirect:
if e, ok := err.(*ce.Redirect); ok {
w.Header().Add("Location", e.URL)
@@ -340,7 +339,6 @@ ERRTYPES:
} else {
w.WriteHeader(301)
}
return
}
case *ce.Internal:
if e, ok := err.(*ce.Internal); ok {
@@ -352,7 +350,6 @@ ERRTYPES:
w.Header().Add("Location", s)
w.WriteHeader(301)
}
return
}
case error:
code := errors.Guarantee(err).Code()
@@ -363,13 +360,13 @@ ERRTYPES:

if ctx.Code() >= 400 {
rt.router.HTTPError(ctx)
w.WriteHeader(ctx.Code())
}
return
w.WriteHeader(ctx.Code())
default:
if err == nil || ctx.Code() == 0 {
ctx.SetCode(200)
}
w.WriteHeader(ctx.Code())
}
}



Loading…
Cancel
Save