Skip to content

Response::body_*blank* doesn't consume the response #363

@laycookie

Description

@laycookie

Hello, just spotted my friend trying to run this in his code:

let text = res.body_string().unwrap();
let json = res.body_json::<T>().unwrap();

This made me slightly confused to when would you want to await for the body twice?
I was just wondering if this has any actual use case to it, or is it just a flaw of the current implantation, because if it is just a flaw of the current implantation I would love to look in to the ways of making it more ergonomic.

My first thought was making body_blank() just consume the response, but if anyone dislikes this idea, I think generics & zero sized types could also be a great solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions