masque_ohttp_client: print response body on errors This helped debug an issue with the relay PiperOrigin-RevId: 857289906
diff --git a/quiche/quic/masque/masque_ohttp_client.cc b/quiche/quic/masque/masque_ohttp_client.cc index af08e1c..6f9fea8 100644 --- a/quiche/quic/masque/masque_ohttp_client.cc +++ b/quiche/quic/masque/masque_ohttp_client.cc
@@ -302,8 +302,17 @@ absl::MakeCleanup([this, it]() { pending_ohttp_requests_.erase(it); }); QUICHE_RETURN_IF_ERROR(response.status()); QUICHE_RETURN_IF_ERROR(CheckGatewayResponse(*response)); - QUICHE_RETURN_IF_ERROR( - CheckStatusAndContentType(*response, "message/ohttp-res")); + absl::Status status = + CheckStatusAndContentType(*response, "message/ohttp-res"); + if (!status.ok()) { + if (!response->body.empty()) { + QUICHE_LOG(ERROR) << "Bad ohttp-res with body:" << std::endl + << response->body; + } else { + QUICHE_LOG(ERROR) << "Bad ohttp-res with empty body"; + } + return status; + } absl::StatusOr<BinaryHttpResponse> binary_response = TryExtractBinaryResponse(request_id, it->second, *response); QUICHE_RETURN_IF_ERROR(binary_response.status());