Skip to content
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

Fix error message about content-types #775

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions duplex_http_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ func (d *duplexHTTPCall) CloseWrite() error {
// response to read from.
if d.requestSent.CompareAndSwap(false, true) {
go d.makeRequest()
// We never setup a request body, so it's effectively already closed.
// So nothing else to do.
Comment on lines +171 to +172
Copy link
Member Author

@jhump jhump Sep 13, 2024

Choose a reason for hiding this comment

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

Unrelated, but I was reading this code and confused at first why it does nothing to close the body. And it's because we haven't set one yet: if d.requestSent is false then the request body is still http.NoBody. So I added a comment for future me :)

return nil
}
// The user calls CloseWrite to indicate that they're done sending data. It's
Expand Down
2 changes: 1 addition & 1 deletion protocol_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ func connectValidateStreamResponseContentType(requestCodecName string, streamTyp
CodeUnknown,
"invalid content-type: %q; expecting %q",
responseContentType,
connectUnaryContentTypePrefix+requestCodecName,
connectStreamingContentTypePrefix+requestCodecName,
)
}
responseCodecName := connectCodecFromContentType(
Expand Down