alyssais / alyssais/hyper-stub

Make `proxy_client_fn` generic over response body type?

未關閉
#3 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
11
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

Or add a new function, if it would otherwise be a breaking change?

### Specifically...

Currently in my non-stub (real) *hyper* server tests, I can use [`hyper::service::service_fn`](https://docs.rs/hyper/0.12.7/hyper/service/fn.service_fn.html) even when the response body type (`body_image::async::UniBodyImage`) is different than the request body type (`hyper::Body`), as in:

https://github.com/dekellum/body-image/blob/master/src/async/tests/server.rs#L245

This works because [`hyper::server::conn::Http::serve_connection`](https://docs.rs/hyper/0.12.7/hyper/server/conn/struct.Http.html#method.serve_connection) is generic over the response body type and (above linked) `service_fn` doesn't specify the response body type.

I was hoping to be able to do the same thing with your [`proxy_client_fn`](https://docs.rs/hyper-stub/0.1.0/hyper_stub/fn.proxy_client_fn.html), as the logically corollary to `service_fn`, but the former is not generic over the response body type.

Could that be changed, either in place or with a new function?

**Edit**: The hyper-stub rustdoc implies that the `proxy_client` function is the most flexible, but using that looks (thought I'm not entirely sure) a good deal more complicated?

Thanks for your consideration.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。