Skip to content

Commit

Permalink
Fixing doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reu committed Jan 28, 2025
1 parent 71f7d5e commit 0049136
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/expect-continue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Service for UploadService {
.unwrap())
}

fn should_continue(&self, req: &Request<Body>) -> StatusCode {
fn should_continue(&mut self, req: &Request<Body>) -> StatusCode {
match req.headers().typed_get::<headers::ContentLength>() {
Some(len) if len.0 <= self.max_length => StatusCode::CONTINUE,
_ => StatusCode::EXPECTATION_FAILED,
Expand Down
6 changes: 3 additions & 3 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ type IncomingRequest = Request<Body>;
/// type Body = &'static str;
/// type Error = Infallible;
///
/// fn call(&self, _req: Request<Body>) -> Result<http::Response<Self::Body>, Self::Error> {
/// fn call(&mut self, _req: Request<Body>) -> Result<http::Response<Self::Body>, Self::Error> {
/// Ok(Response::builder()
/// .status(StatusCode::OK)
/// .body("Thanks for the info!")
/// .unwrap())
/// }
///
/// fn should_continue(&self, req: &Request<Body>) -> StatusCode {
/// fn should_continue(&mut self, req: &Request<Body>) -> StatusCode {
/// match req.headers().typed_get::<headers::ContentLength>() {
/// Some(len) if len.0 <= self.max_length => StatusCode::CONTINUE,
/// _ => StatusCode::EXPECTATION_FAILED,
Expand All @@ -97,7 +97,7 @@ pub trait Service {

fn call(&mut self, request: IncomingRequest) -> Result<Response<Self::Body>, Self::Error>;

fn should_continue(&self, _: &IncomingRequest) -> StatusCode {
fn should_continue(&mut self, _: &IncomingRequest) -> StatusCode {
StatusCode::CONTINUE
}
}
Expand Down

0 comments on commit 0049136

Please sign in to comment.