17 TEST(BodyPostTests, DefaultUrlEncodedPostTest) {
18 auto url =
Url{
base +
"/url_post.html"};
30 TEST(BodyPostTests, TextUrlEncodedPostTest) {
31 auto url =
Url{
base +
"/url_post.html"};
34 " \"x\": hello world!!~\n" 43 TEST(BodyPostTests, TextUrlEncodedNoCopyPostTest) {
44 auto url =
Url{
base +
"/url_post.html"};
45 auto body =
Body{
"x=hello world!!~"};
49 " \"x\": hello world!!~\n" 58 TEST(BodyPostTests, UrlEncodedManyPostTest) {
59 auto url =
Url{
base +
"/url_post.html"};
73 TEST(BodyPostTests, CustomHeaderNumberPostTest) {
74 auto url =
Url{
base +
"/json_post.html"};
75 auto response =
cpr::Post(url,
Body{
"{\"x\":5}"},
Header{{
"Content-Type",
"application/json"}});
84 TEST(BodyPostTests, CustomHeaderTextPostTest) {
85 auto url =
Url{
base +
"/json_post.html"};
86 auto response =
cpr::Post(url,
Body{
"{\"x\":\"hello world!!~\"}"},
87 Header{{
"Content-Type",
"application/json"}});
88 auto expected_text =
std::string{
"{\"x\":\"hello world!!~\"}"};
96 TEST(BodyPostTests, CustomWrongHeaderPostTest) {
97 auto url =
Url{
base +
"/json_post.html"};
99 auto expected_text =
std::string{
"Unsupported Media Type"};
107 TEST(BodyPostTests, UrlPostBadHostTest) {
108 auto url =
Url{
"http://bad_host/"};
117 TEST(BodyPostTests, StringMoveBodyTest) {
118 auto url =
Url{
base +
"/url_post.html"};
130 int main(
int argc,
char** argv) {
Environment * AddGlobalTestEnvironment(Environment *env)
TEST(BodyPostTests, DefaultUrlEncodedPostTest)
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
int main(int argc, char **argv)
#define EXPECT_EQ(expected, actual)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Response Post(Ts &&...ts)