Implement Client trait for StreamContext (#134)

Signed-off-by: José Ulises Niño Rivera <junr03@users.noreply.github.com>
This commit is contained in:
José Ulises Niño Rivera 2024-10-07 19:50:15 -04:00 committed by GitHub
parent 5bfccd3959
commit c1cfbcd44d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 216 additions and 218 deletions

View file

@ -571,6 +571,7 @@ fn request_ratelimited() {
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
.expect_http_call(
Some("api_server"),
Some(vec![
@ -589,15 +590,14 @@ fn request_ratelimited() {
.execute_and_expect(ReturnType::None)
.unwrap();
let response_headers_with_200 = vec![(":status", "200"), ("content-type", "application/json")];
let body_text = String::from("test body");
module
.call_proxy_on_http_call_response(http_context, 5, 0, body_text.len() as i32, 0)
.expect_metric_increment("active_http_calls", -1)
.expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody))
.returning(Some(&body_text))
.expect_get_header_map_pairs(Some(MapType::HttpCallResponseHeaders))
.returning(Some(response_headers_with_200))
.expect_get_header_map_value(Some(MapType::HttpCallResponseHeaders), Some(":status"))
.returning(Some("200"))
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
@ -679,6 +679,7 @@ fn request_not_ratelimited() {
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
.expect_http_call(
Some("api_server"),
Some(vec![
@ -697,16 +698,14 @@ fn request_not_ratelimited() {
.execute_and_expect(ReturnType::None)
.unwrap();
let response_headers_with_200 = vec![(":status", "200"), ("content-type", "application/json")];
let body_text = String::from("test body");
module
.call_proxy_on_http_call_response(http_context, 5, 0, body_text.len() as i32, 0)
.expect_metric_increment("active_http_calls", -1)
.expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody))
.returning(Some(&body_text))
.expect_get_header_map_pairs(Some(MapType::HttpCallResponseHeaders))
.returning(Some(response_headers_with_200))
.expect_get_header_map_value(Some(MapType::HttpCallResponseHeaders), Some(":status"))
.returning(Some("200"))
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)
.expect_log(Some(LogLevel::Debug), None)