Skip to content

Allow getting just Parts from a Builder #372

@jameysharp

Description

@jameysharp

Over in non-binary/http-cache-semantics#2, we're using request::Parts and response::Parts rather than Request or Response because we never care about the bodies. But the builders are still the easiest way to construct those.

So it'd be nice to be able to take a builder and say .parts().unwrap() instead of .body(()).unwrap().into_parts().0. Our callers will likely have full requests and responses so they won't care, this is just nice for situations like our unit tests where we really only need to build the non-body parts.

I think this means adding new methods to the builders along the lines of pub fn parts(self) -> Result<Parts<T>> { self.inner }.

Thoughts?

By the way, thanks for changing the builders to by-value instead of by-reference; that turned out to simplify our code by a lot.

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