Skip to content

http panic in wasm due to capitalized header name #580

Closed
@minijackson

Description

@minijackson

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions