Skip to content

Commit bfa7457

Browse files
author
anahan
committed
Do not read all response before JSON decode
1 parent 1a2619c commit bfa7457

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pkg/phpfpm/status.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,8 @@ func GetStats(net, addr, statusPath string) (*Status, error) {
4343
}
4444
defer tryClose(resp.Body)
4545

46-
content, err := io.ReadAll(resp.Body)
47-
if err != nil {
48-
return nil, err
49-
}
5046
s := Status{}
51-
err = json.Unmarshal(content, &s)
47+
err = json.NewDecoder(resp.Body).Decode(&s)
5248
if err != nil {
5349
return nil, err
5450
}

0 commit comments

Comments
 (0)