hyperium / hyper

An HTTP library for Rust
https://hyper.rs
MIT License
14.58k stars 1.6k forks source link

Custom response header value is a copy of custom request header value #3715

Closed guzzit closed 3 months ago

guzzit commented 3 months ago

Version hyper = "0.14"

Platform macOs 14.5

Description I am sending a request with a custom header to an API, let’s say the custom header is x-reference-id. The API’s response is also meant to contain the custom header x-reference-id, but with a different value. The problem is, I noticed the x-reference-id value of the response is the same as the x-reference-id of the request, so it appears the value of the x-reference-id request header is being copied into that of the response header.

code making the call:

 let response = self
            .client
            .request(request.map(Body::from))
            .await
            .map(|response| {
                tracing::Span::current()
                    .record("http.response.status_code", response.status().as_u16());
                response
            })
            .wrap_err("failed to send request with hyper")?;
seanmonstar commented 3 months ago

This seems highly unlikely to be hyper, and much more likely that the server is sending the header back.

However, can you confirm it happens with any other header? And with other servers?

guzzit commented 3 months ago

This seems highly unlikely to be hyper, and much more likely that the server is sending the header back.

However, can you confirm it happens with any other header? And with other servers?

You're right. Mistake at my end. Thanks!