aboutsummaryrefslogtreecommitdiff
path: root/lib/http/server.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-05-11 23:50:22 +0700
committerShulhan <m.shulhan@gmail.com>2020-05-12 17:26:26 +0700
commitc97c4ff8d531658cbce14310704c5bbb95e95dbd (patch)
treed9ff54c583c3c46719960eb79b519905d5bfc29b /lib/http/server.go
parent25caa3fb9d7c87f08afae5c7f2d742deebb88efc (diff)
downloadpakakeh.go-c97c4ff8d531658cbce14310704c5bbb95e95dbd.tar.xz
http: prefix the header constants with "Header"
Diffstat (limited to 'lib/http/server.go')
-rw-r--r--lib/http/server.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/http/server.go b/lib/http/server.go
index 3f6d92ca..e12c20cf 100644
--- a/lib/http/server.go
+++ b/lib/http/server.go
@@ -373,7 +373,7 @@ func (srv *Server) handleFS(
return
}
- res.Header().Set(ContentType, node.ContentType)
+ res.Header().Set(HeaderContentType, node.ContentType)
if len(node.ContentEncoding) > 0 {
res.Header().Set(ContentEncoding, node.ContentEncoding)
@@ -397,7 +397,7 @@ func (srv *Server) handleFS(
size = int64(len(body))
}
- res.Header().Set(ContentLength, strconv.FormatInt(size, 10))
+ res.Header().Set(HeaderContentLength, strconv.FormatInt(size, 10))
if method == RequestMethodHead {
res.WriteHeader(http.StatusOK)
@@ -449,11 +449,11 @@ func (srv *Server) handleHead(res http.ResponseWriter, req *http.Request) {
res.WriteHeader(http.StatusNoContent)
return
case ResponseTypeBinary:
- res.Header().Set(ContentType, ContentTypeBinary)
+ res.Header().Set(HeaderContentType, ContentTypeBinary)
case ResponseTypeJSON:
- res.Header().Set(ContentType, ContentTypeJSON)
+ res.Header().Set(HeaderContentType, ContentTypeJSON)
case ResponseTypePlain:
- res.Header().Set(ContentType, ContentTypePlain)
+ res.Header().Set(HeaderContentType, ContentTypePlain)
}
res.WriteHeader(http.StatusOK)
@@ -531,7 +531,8 @@ func (srv *Server) handleOptions(res http.ResponseWriter, req *http.Request) {
sort.Strings(allows)
- res.Header().Set("Allow", strings.Join(allows, ", "))
+ res.Header().Set(HeaderAllow, strings.Join(allows, ", "))
+
res.WriteHeader(http.StatusOK)
}