Skip to content

Commit 9da86a0

Browse files
committed
Add Accept-Encoding for gzip responses
1 parent ff5dcd2 commit 9da86a0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

pkg/cyberhub/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ func (c *Client) doRequest(ctx context.Context, method, endpoint string, body io
127127
// 设置请求头
128128
req.Header.Set("X-API-Key", c.apiKey)
129129
req.Header.Set("Content-Type", "application/json")
130+
// 后端要求显式声明 gzip 才会返回压缩数据
131+
req.Header.Set("Accept-Encoding", "gzip")
130132

131133
resp, err := c.httpClient.Do(req)
132134
if err != nil {

0 commit comments

Comments
 (0)