Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: use rw.WriteHeader to write responses without bodies #13870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 11, 2024

Conversation

aslilac
Copy link
Member

@aslilac aslilac commented Jul 10, 2024

the body gets ignored anyway, so why bother allocating/serializing anything?

@aslilac aslilac requested a review from Emyrk July 10, 2024 21:49
@Emyrk
Copy link
Member

Emyrk commented Jul 11, 2024

We also do this tracing span end too:

_, span := tracing.StartSpan(ctx)
defer span.End()

We'd be losing that.

@aslilac
Copy link
Member Author

aslilac commented Jul 11, 2024

yes, but all that span measures is time to encode the body and write it to the wire. I guess we could add a new function that just writes the head and tracks that with a span?

@Emyrk
Copy link
Member

Emyrk commented Jul 11, 2024

I misread what the span did, this is not a big deal 👍

@aslilac aslilac merged commit de2585b into main Jul 11, 2024
29 checks passed
@aslilac aslilac deleted the no-ignored-body branch July 11, 2024 19:38
@github-actions github-actions bot locked and limited conversation to collaborators Jul 11, 2024
Comment on lines -454 to +428
| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ---------------------------------------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.User](schemas.md#codersdkuser) |
| Status | Meaning | Description | Schema |
| ------ | --------------------------------------------------------------- | ----------- | ------ |
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
Copy link
Member

@Emyrk Emyrk Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a breaking change that we missed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants