Created
November 9, 2015 19:05
Revisions
-
andrewhampton created this gist
Nov 9, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // buildRedirect creates a 302 redirect for the request func buildRedirect(request *http.Request) *http.Response { log.Printf("transport: building redirect for: %s", request.URL.String()) response := &http.Response{ StatusCode: http.StatusFound, Header: make(map[string][]string), Body: buildEmptyBody()} response.Header.Add("Location", request.URL.String()) return response } func buildEmptyBody() io.ReadCloser { return ioutil.NopCloser(bytes.NewReader([]byte(""))) }