George Liu | 647b3cd | 2021-07-05 12:43:56 +0800 | [diff] [blame] | 1 | #include <http_utility.hpp> |
| 2 | |
| 3 | #include "gmock/gmock.h" |
| 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 | } |