Nan Zhou | 93b443d | 2022-06-21 17:46:51 +0000 | [diff] [blame] | 1 | #include "http_utility.hpp" |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 2 | |
Nan Zhou | 93b443d | 2022-06-21 17:46:51 +0000 | [diff] [blame] | 3 | #include <gtest/gtest.h> |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 4 | |
Nan Zhou | ad3edd4 | 2022-06-21 17:46:44 +0000 | [diff] [blame^] | 5 | namespace http_helpers |
| 6 | { |
| 7 | namespace |
| 8 | { |
| 9 | |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 10 | TEST(HttpUtility, requestPrefersHtml) |
| 11 | { |
Nan Zhou | ad3edd4 | 2022-06-21 17:46:44 +0000 | [diff] [blame^] | 12 | EXPECT_FALSE(requestPrefersHtml("*/*, application/octet-stream")); |
| 13 | EXPECT_TRUE(isOctetAccepted("*/*, application/octet-stream")); |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 14 | |
Nan Zhou | ad3edd4 | 2022-06-21 17:46:44 +0000 | [diff] [blame^] | 15 | EXPECT_TRUE(requestPrefersHtml("text/html, application/json")); |
| 16 | EXPECT_FALSE(isOctetAccepted("text/html, application/json")); |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 17 | |
Nan Zhou | ad3edd4 | 2022-06-21 17:46:44 +0000 | [diff] [blame^] | 18 | EXPECT_FALSE(requestPrefersHtml("application/json")); |
| 19 | EXPECT_FALSE(isOctetAccepted("application/json")); |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 20 | } |
Nan Zhou | ad3edd4 | 2022-06-21 17:46:44 +0000 | [diff] [blame^] | 21 | |
| 22 | } // namespace |
| 23 | } // namespace http_helpers |