Skip to content

Commit

Permalink
respect a brader range of 30x status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Mancke committed Jul 13, 2016
1 parent d806d78 commit fa4a2d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composition/composition_handler.go
Expand Up @@ -47,7 +47,7 @@ func (agg *CompositionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
for _, res := range results {
if res.Err == nil && res.Content != nil {

if res.Content.HttpStatusCode() == 301 || res.Content.HttpStatusCode() == 302 || res.Content.HttpStatusCode() == 303 {
if res.Content.HttpStatusCode() >= 300 && res.Content.HttpStatusCode() <= 308 {
copyHeaders(res.Content.HttpHeader(), w.Header(), ForwardResponseHeaders)
w.WriteHeader(res.Content.HttpStatusCode())
return
Expand Down
2 changes: 1 addition & 1 deletion composition/http_content_loader_test.go
Expand Up @@ -222,7 +222,7 @@ func Test_HttpContentLoader_FollowRedirects(t *testing.T) {
func Test_HttpContentLoader_DoNotFollowRedirects(t *testing.T) {
a := assert.New(t)

for _, status := range []int{301, 302, 303} {
for _, status := range []int{301, 302, 303, 305, 307, 308} {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/redirected" {
http.Redirect(w, r, "/redirected", status)
Expand Down

0 comments on commit fa4a2d1

Please sign in to comment.