Skip to content

Conversation

@redscholar
Copy link
Contributor

@redscholar redscholar commented Oct 31, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

  • Updated responseWriter to capture HTTP responses more effectively by using an internal buffer for the response body.
  • Modified Header and Write methods to directly manipulate the response object.
  • Ensured that the response body is set correctly after processing the request, defaulting to 200 OK if no status code is set.

Which issue(s) this PR fixes:

Fixes #
The reason responseWriter.Write() is called in multiple chunks is that the Go HTTP server flushes data in segments when its internal buffer is full. Even if your handler writes the entire response in one call, the server may split it into multiple writes to the underlying ResponseWriter. io.NopCloser itself does not split the data; the chunked writes come from the server’s internal buffering and flush behavior.
企业微信截图_fd61d24e-dfbe-4863-9ef5-c8a0696a2ca9

Special notes for reviewers:

Does this PR introduced a user-facing change?

improve responseWriter implementation in proxy transport

Additional documentation, usage docs, etc.:


@kubesphere-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: redscholar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubesphere-prow kubesphere-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 31, 2025
@sonarqubecloud
Copy link

@zuoxuesong-worker
Copy link
Contributor

zuoxuesong-worker commented Nov 3, 2025

/lgtm

@zuoxuesong-worker zuoxuesong-worker added the lgtm Indicates that a PR is ready to be merged. label Nov 3, 2025
@ks-ci-bot ks-ci-bot merged commit 4c71311 into kubesphere:main Nov 3, 2025
13 checks passed
@redscholar redscholar deleted the fix-slice-response branch November 7, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants