blob: 32591a482f527dcb262c864eddc83769802acb98 [file] [log] [blame]
George Liu647b3cd2021-07-05 12:43:56 +08001#include <http_utility.hpp>
2
3#include "gmock/gmock.h"
4
5TEST(HttpUtility, requestPrefersHtml)
6{
George Liu647b3cd2021-07-05 12:43:56 +08007 EXPECT_FALSE(
Ed Tanous8e659c82021-10-05 12:49:06 -07008 http_helpers::requestPrefersHtml("*/*, application/octet-stream"));
9 EXPECT_TRUE(http_helpers::isOctetAccepted("*/*, application/octet-stream"));
George Liu647b3cd2021-07-05 12:43:56 +080010
George Liu647b3cd2021-07-05 12:43:56 +080011 EXPECT_TRUE(
Ed Tanous8e659c82021-10-05 12:49:06 -070012 http_helpers::requestPrefersHtml("text/html, application/json"));
13 EXPECT_FALSE(http_helpers::isOctetAccepted("text/html, application/json"));
George Liu647b3cd2021-07-05 12:43:56 +080014
Ed Tanous8e659c82021-10-05 12:49:06 -070015 EXPECT_FALSE(http_helpers::requestPrefersHtml("application/json"));
16 EXPECT_FALSE(http_helpers::isOctetAccepted("application/json"));
George Liu647b3cd2021-07-05 12:43:56 +080017}