-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(volo-http): unwrap request and response (#319)
* chore(volo-http): unwrap `Request` and `Response` * chore(volo-http): refactor and enhance filter layer * chore(volo-http): bump volo-http to 0.1.9 --------- Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
- Loading branch information
1 parent
4efb1e4
commit 6a3aaad
Showing
8 changed files
with
95 additions
and
145 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1 @@ | ||
use std::ops::{Deref, DerefMut}; | ||
|
||
use hyper::{body::Incoming, http::request::Builder}; | ||
|
||
pub struct Request(pub(crate) hyper::http::Request<hyper::body::Incoming>); | ||
|
||
impl Request { | ||
pub fn builder() -> Builder { | ||
Builder::new() | ||
} | ||
} | ||
|
||
impl Deref for Request { | ||
type Target = hyper::http::Request<hyper::body::Incoming>; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
&self.0 | ||
} | ||
} | ||
|
||
impl DerefMut for Request { | ||
fn deref_mut(&mut self) -> &mut Self::Target { | ||
&mut self.0 | ||
} | ||
} | ||
|
||
impl From<hyper::http::Request<Incoming>> for Request { | ||
fn from(value: hyper::http::Request<Incoming>) -> Self { | ||
Self(value) | ||
} | ||
} | ||
pub type Request<B = hyper::body::Incoming> = hyper::http::Request<B>; |
Oops, something went wrong.