main: write status code first - twitch-go - twitch.tv web application in Go
(HTM) git clone git://git.codemadness.org/twitch-go
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 8d76f4f7ae7abefc7ae35e0644f9c86b299020ba
(DIR) parent 0c60e04a9eb3ae0d7271616371b8de391df2e629
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 11 Apr 2015 20:54:47 +0200
main: write status code first
Diffstat:
M main.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/main.go b/main.go
@@ -345,8 +345,8 @@ func PlaylistHandler(w http.ResponseWriter, r *http.Request, m *RouteMatch) erro
w.Write([]byte(url))
break
default: // redirect
- w.Header().Set("Location", url)
w.WriteHeader(http.StatusFound)
+ w.Header().Set("Location", url)
w.Write([]byte(url))
}
return nil
@@ -386,8 +386,8 @@ func LinksHandler(w http.ResponseWriter, r *http.Request, m *RouteMatch) error {
// on error the old templates are kept in memory.
func ReloadTemplateHandler(w http.ResponseWriter, r *http.Request, m *RouteMatch) error {
if appconfig.Password == "" || m.Names["password"] != appconfig.Password {
- w.Write([]byte("401: unauthorized"))
w.WriteHeader(http.StatusUnauthorized)
+ w.Write([]byte("401: unauthorized"))
return nil
}
newpages, err := LoadPages(appconfig.TemplatePageDir)