Skip to content

Commit

Permalink
no need to map
Browse files Browse the repository at this point in the history
  • Loading branch information
StuartHarris committed Jan 23, 2025
1 parent 75bcee2 commit 00d1640
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 2 additions & 6 deletions crux_http/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,14 @@ where
.expect("should be able to convert request to protocol request");

let result = Command::request_from_shell(operation)
.map(|http_result| match http_result {
HttpResult::Ok(response) => Ok(response),
HttpResult::Err(error) => Err(error.clone()),
})
.into_future(ctx)
.await;

match result {
Ok(response) => Response::<Vec<u8>>::new(response.into())
HttpResult::Ok(response) => Response::<Vec<u8>>::new(response.into())
.await
.and_then(|r| self.expectation.decode(r)),
Err(error) => Err(error),
HttpResult::Err(error) => Err(error),
}
})
}
Expand Down
8 changes: 4 additions & 4 deletions crux_http/tests/with_tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ mod shared {
.build()
.into_future(ctx.clone())
.await
.expect("Send async should succeed");
.unwrap();
let text = response.body_string().expect("response should have body");

let response = command::Http::post(format!("http://example.com/{}", text))
.build()
.into_future(ctx.clone())
.await
.expect("Send async should succeed");
.unwrap();

ctx.send_event(Event::ComposeComplete(response.status()))
}),
Expand All @@ -96,8 +96,8 @@ mod shared {

let (response_one, response_two) = join!(one, two);

let one = response_one.expect("Send async should succeed");
let two = response_two.expect("Send async should succeed");
let one = response_one.unwrap();
let two = response_two.unwrap();

let status =
StatusCode::try_from(max::<u16>(one.status().into(), two.status().into()))
Expand Down

0 comments on commit 00d1640

Please sign in to comment.