Closed goodclouddata closed 5 years ago
http::Response<T>
is generic over the body type. It looks like the inner future's response body type is not String
, yet you are trying to return String
.
You can either map String
to the same type as the inner future's body type or your future can have a body type of Either<InnerResponseBody, String>
. (Either)
Hope this helps!
Ok.I'll try.Thanks!
I wtrite a middleware, to special URL,It should direct return a response,or it return inner Service,But when compiler ,what wrong with it?
//code is here, the key code bettwen //---------
impl<T, B> Future for ResponseFuture
where
T: Future<Item = http::Response>,
T::Error: ::std::error::Error,
B: BufStream,
{
type Item = T::Item;
type Error = T::Error;
//------------------------------------------------------ let full_path = self.path.as_ref().map(|p| p.as_str()).unwrap_or("/");
//----------------------------------------------------- }
}
//eror is here
--> src/logic/interceptor.rs:86:29
std::string::String
= note: expected type
http::Response<B>
found type
http::Response<std::string::String>
error: aborting due to previous error