Skip to content

Error decoding response body: data did not match any variant of untagged enum Response #11

Description

@jrouaix

Hello,
I'm starting to use your crate, it'll help a lot I think ! Thank you !

Tried to do kind of the same as the example and I have an error :

    let search_response: Response<MyIndex> = response.json().await?; 

Will produce a serde error :

Caused by:
    0: error decoding response body: data did not match any variant of untagged enum Response
    1: error decoding response body: data did not match any variant of untagged enum Response
    2: data did not match any variant of untagged enum Response

If I only assume the response will be Ok I can do this and it's working fine :

    let results: OkResponse<MyIndex> = response.json().await?;
    let items = results.hits.hits.into_iter().map(|idx| idx.source.payload).collect();
    Ok(items)

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