http panic in wasm due to capitalized header name
minijackson opened this issue · 2 comments
Description
Hello! I'm building a wasm app using meilisearch-sdk, and found this confusing error when calling Client::new
:
index out of bounds: the len is 0 but the index is 0
Expected behavior
Client::new
does not panic.
Current behavior
Turns out it's http
's way of telling us that a header name is capitalized, and panics.
Here's the http
code that panics (HeaderName::from_static
):
https://github.com/hyperium/http/blob/v1.1.0/src/header/name.rs#L1197-L1224
And I think the X-Meilisearch-Client
is what causes it:
https://github.com/meilisearch/meilisearch-rust/blob/v0.26.0/src/reqwest.rs#L35
Environment (please complete the following information):
- OS: wasm32
- Meilisearch version: v1.7.6
- meilisearch-rust version: v0.26.0
- http version: v1.1.0 (behavior should be the same with http v1.0.0)
As specified in this seanmonstar/reqwest#630 response headers
implementation is not officially supported in reqwest
.
web_sys
should be used for every request to be sure of wasm support.
I guess someone broke it recently.
Hey @minijackson,
Could you retry your app with this branch and let me know if everything works: #582
I’m struggling to run the example in this repo