Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jrouaix opened this issue May 18, 2021 · 0 comments

Comments

@jrouaix
Copy link

jrouaix commented May 18, 2021

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant