Skip to content

Commit aae423a

Browse files
authored
fix: net::ERR_INCOMPLETE_CHUNKED_ENCODING (#4061)
Signed-off-by: Cheyu Wu <[email protected]>
1 parent 0bbdec2 commit aae423a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

apiserversdk/proxy.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ func (rrt *retryRoundTripper) RoundTrip(req *http.Request) (*http.Response, erro
151151
}
152152

153153
if apiserversdkutil.IsSuccessfulStatusCode(resp.StatusCode) {
154+
if resp.Body != nil {
155+
body, err := io.ReadAll(resp.Body)
156+
if err != nil {
157+
return nil, fmt.Errorf("failed to read response body: %w", err)
158+
}
159+
err = resp.Body.Close()
160+
if err != nil {
161+
return nil, fmt.Errorf("failed to close response body: %w", err)
162+
}
163+
resp.Body = io.NopCloser(bytes.NewReader(body))
164+
}
154165
return resp, nil
155166
}
156167

0 commit comments

Comments
 (0)