in lambda-runtime-api-client/src/lib.rs [59:79]
fn set_origin<B>(&self, req: Request<B>) -> Result<Request<B>, Error> {
let (mut parts, body) = req.into_parts();
let (scheme, authority, base_path) = {
let scheme = self.base.scheme().unwrap_or(&Scheme::HTTP);
let authority = self.base.authority().expect("Authority not found");
let base_path = self.base.path().trim_end_matches('/');
(scheme, authority, base_path)
};
let path = parts.uri.path_and_query().expect("PathAndQuery not found");
let pq: PathAndQuery = format!("{}{}", base_path, path).parse().expect("PathAndQuery invalid");
let uri = Uri::builder()
.scheme(scheme.as_ref())
.authority(authority.as_ref())
.path_and_query(pq)
.build()
.map_err(Box::new)?;
parts.uri = uri;
Ok(Request::from_parts(parts, body))
}