Skip to content

Commit f47e169

Browse files
committed
Unexpose mutex in Response
1 parent 51cd8d9 commit f47e169

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

jsend.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ type Response struct {
119119
code int
120120
sent bool
121121
fields map[string]interface{}
122-
sync.Mutex
122+
mu sync.Mutex
123123
}
124124

125125
// Field method allows you to set custom response fields.
@@ -165,8 +165,8 @@ var errSentAlready = errors.New("jsend: sent already")
165165

166166
// Send encodes and writes buffered data to underlying http response object.
167167
func (r *Response) Send() (int, error) {
168-
r.Lock()
169-
defer r.Unlock()
168+
r.mu.Lock()
169+
defer r.mu.Unlock()
170170

171171
if r.sent {
172172
return 0, errSentAlready

0 commit comments

Comments
 (0)