From 00a35eeee27917c85f8bb77ef45dc7ee72d24339 Mon Sep 17 00:00:00 2001 From: daidai Date: Wed, 4 Dec 2024 08:34:28 +0800 Subject: [PATCH] fix ut --- be/src/http/http_handler_with_auth.cpp | 2 +- be/test/http/http_client_test.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/be/src/http/http_handler_with_auth.cpp b/be/src/http/http_handler_with_auth.cpp index ce9db98f6e25ea..ae5c024e76d093 100644 --- a/be/src/http/http_handler_with_auth.cpp +++ b/be/src/http/http_handler_with_auth.cpp @@ -108,7 +108,7 @@ int HttpHandlerWithAuth::on_header(HttpRequest* req) { auth_result.status.status_code = TStatusCode::type::OK; auth_result.status.error_msgs.clear(); } else { - HttpChannel::send_reply(req, HttpStatus::BAD_REQUEST); + HttpChannel::send_reply(req, HttpStatus::FORBIDDEN); return -1; } #endif diff --git a/be/test/http/http_client_test.cpp b/be/test/http/http_client_test.cpp index d42e0a6775ed4b..c98328d7c8e37c 100644 --- a/be/test/http/http_client_test.cpp +++ b/be/test/http/http_client_test.cpp @@ -413,7 +413,7 @@ TEST_F(HttpClientTest, enable_http_auth) { EXPECT_TRUE(!st.ok()); std::cout << "response = " << response << "\n"; std::cout << "st.msg() = " << st.msg() << "\n"; - EXPECT_TRUE(st.msg().find("Operation timed out after") != std::string::npos); + EXPECT_TRUE(st.msg().find("403") != std::string::npos); } { @@ -474,7 +474,7 @@ TEST_F(HttpClientTest, enable_http_auth) { EXPECT_TRUE(!st.ok()); std::cout << "response = " << response << "\n"; std::cout << "st.msg() = " << st.msg() << "\n"; - EXPECT_TRUE(st.msg().find("Operation timed out after") != std::string::npos); + EXPECT_TRUE(st.msg().find("403") != std::string::npos); } // valid token @@ -521,7 +521,7 @@ TEST_F(HttpClientTest, enable_http_auth) { EXPECT_TRUE(!st.ok()); std::cout << "response = " << response << "\n"; std::cout << "st.msg() = " << st.msg() << "\n"; - EXPECT_TRUE(st.msg().find("Operation timed out after") != std::string::npos); + EXPECT_TRUE(st.msg().find("403") != std::string::npos); } std::vector check_get_list = {"/api/clear_cache/aa", @@ -566,7 +566,7 @@ TEST_F(HttpClientTest, enable_http_auth) { EXPECT_TRUE(!st.ok()); std::cout << "response = " << response << "\n"; std::cout << "st.msg() = " << st.msg() << "\n"; - EXPECT_TRUE(st.msg().find("Operation timed out after") != std::string::npos); + EXPECT_TRUE(st.msg().find("403") != std::string::npos); } } }