reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

InvalidHeaderName

Open buf1024 opened this issue 2 years ago • 1 comments

the reqwest report errors when add the following headers:

:method: GET
:scheme: https
:authority: raw.githubusercontent.com
:path: txtx

the code to test:

let mut h = header::HeaderMap::new();
h.insert(":authority", header::HeaderValue::from_static(
                "raw.githubusercontent.com"));

panic:

panicked at 'static str is invalid name: InvalidHeaderName'

How to add http headers prefix ":" showed above? thanks a lot!

buf1024 avatar Mar 06 '22 13:03 buf1024

The HTTP2 pseudo headers will be set automatically if the connection is h2.

seanmonstar avatar Mar 06 '22 15:03 seanmonstar