blob: 5fddc5785b998362880a858763de50894bb0ca4d [file] [log] [blame]
Nan Zhou93b443d2022-06-21 17:46:51 +00001#include "http_utility.hpp"
George Liu647b3cd2021-07-05 12:43:56 +08002
Nan Zhou93b443d2022-06-21 17:46:51 +00003#include <gtest/gtest.h>
George Liu647b3cd2021-07-05 12:43:56 +08004
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}