pencil icon indicating copy to clipboard operation
pencil copied to clipboard

Re-export hyper Request

Open dbrgn opened this issue 8 years ago • 6 comments

The field Request.request is a hyper::server::request::Request. Please consider re-exporting (pub use) that type (e.g. as HyperRequest) in your API, so that users don't have to add an explicit dependency on a specific version of Hyper.

dbrgn avatar Mar 30 '16 13:03 dbrgn

If we are doing that, we might need to re-export everything else too, not a good idea. For now I think it is ok for one application to depend on a specific version of Hyper if the app needs it. If there are any better solutions, please wake me up :)

fengsp avatar May 12 '16 09:05 fengsp

Iron is also re-exporting Hyper types.

dbrgn avatar May 12 '16 09:05 dbrgn

The problem is that the user needs to update the version of Hyper every time he/she updates pencil (even for a minor version). And to be able to do that, one needs to look at the source repository at that version to see the exact dependency requirement.

dbrgn avatar May 12 '16 09:05 dbrgn

I would propose to do the entire opposite: hide hyper as much as possible and only give access to it through well hidden APIs. Hyper will undergo big changes going forward from what I can tell and the typed high level access is actually really inconvenient as a user.

I would propose to find the places where one currently needs to get the hyper object and instead to provide convenience APIs to avoid it. For instance there should be a header view for the request to access the header values a strings. Likewise there should be a way to set and view response headers as strings without having to interface with hyper as well.

Ideally in the public API hyper is entirely invisible.

WRT version mismatches: cargo is planning on coming up with a story for such public API re-exports so this will get easier going forward.

mitsuhiko avatar Jul 17 '16 05:07 mitsuhiko

Hide hyper as much as possible, we should try to do this better.

fengsp avatar Jul 18 '16 06:07 fengsp

I think I agree with @mitsuhiko.

dbrgn avatar Jul 18 '16 07:07 dbrgn