Skip to content

Commit 95228f5

Browse files
allegedly a fix
I sense slop but we'll try it
1 parent 1135751 commit 95228f5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/hyperapp.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,17 @@ pub fn get_http_method() -> Option<String> {
8282
// Get a specific header from the current HTTP request
8383
// Returns None if not in HTTP context or header doesn't exist
8484
pub fn get_request_header(name: &str) -> Option<String> {
85+
use http::header::HeaderName;
86+
8587
APP_HELPERS.with(|helpers| {
8688
helpers
8789
.borrow()
8890
.current_http_context
8991
.as_ref()
9092
.and_then(|ctx| {
91-
ctx.request.headers().get(name)
93+
// Convert string to HeaderName
94+
let header_name = HeaderName::from_bytes(name.as_bytes()).ok()?;
95+
ctx.request.headers().get(&header_name)
9296
.and_then(|value| value.to_str().ok())
9397
.map(|s| s.to_string())
9498
})

0 commit comments

Comments
 (0)