Skip to content

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

Merged
aslilac merged 3 commits into
mainfrom
no-ignored-body
Jul 11, 2024
Merged

chore: use rw.WriteHeader to write responses without bodies#13870
aslilac merged 3 commits into
mainfrom
no-ignored-body

Conversation

@aslilac
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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 thread docs/api/users.md
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
Copy Markdown
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