Skip to content

Commit

Permalink
add content length header in jsend
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush.s committed Jun 9, 2021
1 parent f47e169 commit 7a9f95f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jsend.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import (
"encoding/json"
"errors"
"net/http"
"strconv"
"sync"
)

Expand Down Expand Up @@ -190,6 +191,7 @@ func (r *Response) Send() (int, error) {
}

j, err := json.Marshal(r.fields)
r.Header().Set("Content-Length", strconv.Itoa(len(j)))

if err != nil {
return 0, err
Expand Down

0 comments on commit 7a9f95f

Please sign in to comment.