aboutsummaryrefslogtreecommitdiff
path: root/lib/http
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-10-17 15:08:03 +0700
committerShulhan <ms@kilabit.info>2019-10-17 15:08:03 +0700
commit21edfbc8ee4c41bf157f89b42bc5e7c5abb0cb16 (patch)
tree77bc5477a1f13ad3570a67f3b0d23242d53fd892 /lib/http
parentc698f9750a2a30e56a1581aab7fa56b13d32007e (diff)
downloadpakakeh.go-21edfbc8ee4c41bf157f89b42bc5e7c5abb0cb16.tar.xz
http: remove unneccesary call to WriteHeader with StatusOK
Per documentation, If WriteHeader is not called explicitly, the first call to Write will trigger an implicit WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly used to send error codes.
Diffstat (limited to 'lib/http')
-rw-r--r--lib/http/endpoint.go2
1 files changed, 0 insertions, 2 deletions
diff --git a/lib/http/endpoint.go b/lib/http/endpoint.go
index c56f5e76..49fc0c28 100644
--- a/lib/http/endpoint.go
+++ b/lib/http/endpoint.go
@@ -119,8 +119,6 @@ func (ep *Endpoint) call(
res.Header().Set(ContentType, ContentTypePlain)
}
- res.WriteHeader(http.StatusOK)
-
_, e = res.Write(rspb)
if e != nil {
log.Printf("endpoint.call: %s %s %s\n", req.Method, req.URL.Path, e)