-
Notifications
You must be signed in to change notification settings - Fork 338
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
What version of workers-rs
are you using?
0.0.23
What version of wrangler
are you using?
3.39.0
Describe the bug
After experimenting with the new http feature, I noticed that transfer-encoding: chunked
is returned for all responses, even when manually specifying a content-length
header. I'm not sure this is a problem for everyone but it's a change from earlier releases.
Steps To Reproduce
Prior release returning Content-Length: 2
:
#[event(fetch)]
async fn fetch(_req: Request, _env: Env, _ctx: Context) -> Result<worker::Response> {
let mut headers = Headers::new();
let _ = headers.set("content-type", "application/json");
let response = worker::Response::from_bytes("{}".into())
.unwrap()
.with_headers(headers);
Ok(response)
}
HTTP/1.1 200 OK
Content-Length: 2
Content-Type: application/json
0.0.23 release returning Transfer-Encoding: chunked
:
#[event(fetch)]
async fn fetch(req: HttpRequest, _env: Env, _ctx: Context) -> Result<http::Response<axum::body::Body>> {
Ok(http::Response::builder()
.header("content-type", "application/json")
.header("content-length", "2")
.body("{}".into())
.unwrap())
}
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/json
Metadata
Metadata
Assignees
Labels
No labels