Missing response headers
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- rust
- 领域
- networking
调研方向
首先使用 ehttp::fetch 重现该问题,并通过 Response.headers 检查响应标头,使用报告中显示的请求和响应代码。跟踪标头的收集和公开方式,然后验证修复完成后预期的响应标头是否可用。
由索引模型根据 Issue 内容生成。
描述
Dear all,
I just discovered an issue while using ehttp for some AJAX calls.
Apparently, I can't get all the headers from the HTTP response.
As shown below, iterating over them returns only the two standard ones (content-length and content-type).
Maybe I am missing something, but before diving into the ehttp implementation, does anyone have a hint? 🤓
It is added to the UI (an eframe based project, ofc) as a dependency like this:
ehttp = { version = "=0.5.0", features = [ "json" ] }
And this is the code for this case:
fn handle_login(user: String, pass: String, sender: Sender<UiMessage>, ectx: egui::Context) {
let body = LoginRequest::new(user, pass);
let mut req = ehttp::Request::post("http://localhost:9010/api/login", body.as_json().as_bytes().to_vec());
req.headers.insert("Content-Type", "application/json".to_string());
ehttp::fetch(req, move |rsp| {
match rsp {
Ok(rsp) => {
if rsp.status == 200 {
log::info!("[handle_login] Login successful!");
log::info!("[handle_login] Got response: {:?}", rsp);
log::info!("[handle_login] Got user session: {:?}", rsp.headers.get(APP_HEADER_SESSION));
for (header, value) in rsp.headers {
log::info!("header {}: {}", header, value);
}
let account = serde_json::from_slice::<UserAccount>(rsp.bytes.as_slice()).unwrap();
ectx.request_repaint(); // wake up UI thread
if let Err(e) = sender.send(UiMessage::Login(Ok(Some(account)))) {
log::info!("[handle_login] Failed to send Login message. Error: {e}");
}
} else {
log::info!("[handle_login] Login failed! HTTP status code: {}", rsp.status);
let aerr = match rsp.status {
401 => AppError::LoginWrongCredentials,
_ => AppError::from(format!("{}", rsp.status)),
};
if let Err(e) = sender.send(UiMessage::Login(Err(aerr))) {
log::info!("[handle_login] Failed to send Login message. Error: {e}");
}
}
}
Err(e) => log::info!("[handle_login] Login failed! Error: {}", e),
}
});
}
Thanks in advance!
- 主要语言
- Rust
- 星标
- 404
- 派生
- 38
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
emilk/ehttp 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 68/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 2/5 1-3 小时 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 48/100
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
autofixer: follow-up triage: bug triage: classified triage: correctness triage: has-reproducer
难度 2/5 1-3 小时 新手友好度 67/100
tursodatabase/turso#13221 ·
维护者通常 1 天内回复
-
Update Wasmtime to 48.0.11 for RUSTSEC-2026-0648可能已有人在做 @flyingrobots 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 67/100
flyingrobots/edict#457 ·
-
难度 1/5 1 小时以内 新手友好度 72/100
-
O-windows relnotes relnotes-needs-review relnotes-tracking-issue T-libs
难度 1/5 1 小时以内 新手友好度 68/100
维护者通常 1 天内回复