Skip to content

Commit 7ab9017

Browse files
feat: Remove unnecessary OK header
1 parent 556474e commit 7ab9017

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,6 @@ func midLog2(n errhandler.Wrap) errhandler.Wrap {
8383
func addProduct(w http.ResponseWriter, r *http.Request) error {
8484
...
8585
}
86-
```
86+
```
87+
88+

errhandler.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ func (fn Wrap) ServeHTTP(w http.ResponseWriter, r *http.Request) {
2424
// SendJSON returns a JSON response to the caller, or fails with an error.
2525
func SendJSON(w http.ResponseWriter, data interface{}) error {
2626
w.Header().Set("Content-Type", "application/json")
27-
w.WriteHeader(http.StatusOK)
2827
if err := json.NewEncoder(w).Encode(data); err != nil {
2928
return err
3029
}
@@ -34,7 +33,6 @@ func SendJSON(w http.ResponseWriter, data interface{}) error {
3433
// SendString returns a string response to the caller, or fails with an error.
3534
func SendString(w http.ResponseWriter, message string) error {
3635
w.Header().Set("Content-Type", "text/plain")
37-
w.WriteHeader(http.StatusOK)
3836
if _, err := w.Write([]byte(message)); err != nil {
3937
return err
4038
}

0 commit comments

Comments
 (0)