Skip to content

Commit 7a9f95f

Browse files
author
aayush.s
committed
add content length header in jsend
1 parent f47e169 commit 7a9f95f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

jsend.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import (
6161
"encoding/json"
6262
"errors"
6363
"net/http"
64+
"strconv"
6465
"sync"
6566
)
6667

@@ -190,6 +191,7 @@ func (r *Response) Send() (int, error) {
190191
}
191192

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

194196
if err != nil {
195197
return 0, err

0 commit comments

Comments
 (0)