File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,27 @@ func Kitspace(ctx *context.Context) {
4747 req , _ := http .NewRequest ("GET" , url .String (), bytes .NewBuffer (b ))
4848 req .Header .Add ("Content-Type" , "application/json" )
4949
50- resp , err := http .DefaultClient .Do (req )
50+ // a http client that doesn't follow redirects, since we want the user's
51+ // browser to get the redirect status codes instead
52+ client := & http.Client {
53+ CheckRedirect : func (req * http.Request , via []* http.Request ) error {
54+ return http .ErrUseLastResponse
55+ },
56+ }
57+
58+ resp , err := client .Do (req )
59+
5160 if err != nil {
5261 panic (err )
5362 }
5463
5564 ctx .Resp .Header ().Set ("Content-Type" , resp .Header .Get ("Content-Type" ))
5665
66+ location := resp .Header .Get ("Location" )
67+ if location != "" {
68+ ctx .Resp .Header ().Set ("Location" , location )
69+ }
70+
5771 defer resp .Body .Close ()
5872 body , err := ioutil .ReadAll (resp .Body )
5973 if err != nil {
You can’t perform that action at this time.
0 commit comments