[axum] Any way to get non-standard headers in handler

I need a non-standard header in my handler function ("X-Amzn-Trace-Id").

Since it's not one of the headers that axum knows about, I tried implementing TypedHeader, but I triggered the ([] as [u8; 0])[0]; // Invalid header name, which is apparently axum's way of tellling you "unknown header" at compile time.

Is there any way to get a header that axum doesn't know about into my handler?

Damn it, I need to learn to RTFM! The header must be lower case ("x-amzn-trace-id"). Now TypedHeader works fine.

1 Like