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 | |
| 5 | TEST(HttpUtility, requestPrefersHtml) |
| 6 | { |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 7 | EXPECT_FALSE( |
Ed Tanous | 8e659c8 | 2021-10-05 12:49:06 -0700 | [diff] [blame] | 8 | http_helpers::requestPrefersHtml("*/*, application/octet-stream")); |
| 9 | EXPECT_TRUE(http_helpers::isOctetAccepted("*/*, application/octet-stream")); |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 10 | |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 11 | EXPECT_TRUE( |
Ed Tanous | 8e659c8 | 2021-10-05 12:49:06 -0700 | [diff] [blame] | 12 | http_helpers::requestPrefersHtml("text/html, application/json")); |
| 13 | EXPECT_FALSE(http_helpers::isOctetAccepted("text/html, application/json")); |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 14 | |
Ed Tanous | 8e659c8 | 2021-10-05 12:49:06 -0700 | [diff] [blame] | 15 | EXPECT_FALSE(http_helpers::requestPrefersHtml("application/json")); |
| 16 | EXPECT_FALSE(http_helpers::isOctetAccepted("application/json")); |
George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 17 | } |