Package: net-cpp / 2.2.1+dfsg1-6

1003_port-to-new-json-cpp-API.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
From 137154eacd98118beef0664d47a2eae82eefd1f0 Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca@z3ntu.xyz>
Date: Sat, 9 Feb 2019 01:31:42 +0100
Subject: [PATCH] Port to new jsoncpp API

---
 tests/http_client_load_test.cpp      | 14 +++--
 tests/http_client_test.cpp           | 80 +++++++++++++++++-----------
 tests/http_streaming_client_test.cpp | 75 +++++++++++++++-----------
 3 files changed, 99 insertions(+), 70 deletions(-)

diff --git a/tests/http_client_load_test.cpp b/tests/http_client_load_test.cpp
index 79d125b..105c316 100644
--- a/tests/http_client_load_test.cpp
+++ b/tests/http_client_load_test.cpp
@@ -132,10 +132,6 @@ TEST_F(HttpClientLoadTest, async_head_request_for_existing_resource_succeeds)
 
     auto response_verifier = [](const http::Response& response) -> bool
     {
-        // All endpoint data on httpbin.org is JSON encoded.
-        json::Value root;
-        json::Reader reader;
-
         // We expect the query to complete successfully
         EXPECT_EQ(core::net::http::Status::ok, response.status);
 
@@ -159,12 +155,13 @@ TEST_F(HttpClientLoadTest, async_get_request_for_existing_resource_succeeds)
     {
         // All endpoint data on httpbin.org is JSON encoded.
         json::Value root;
-        json::Reader reader;
+        json::CharReaderBuilder builder;
+        std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
         // We expect the query to complete successfully
         EXPECT_EQ(core::net::http::Status::ok, response.status);
         // Parsing the body of the response as JSON should succeed.
-        EXPECT_TRUE(reader.parse(response.body, root));
+        EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
         // The url field of the payload should equal the original url we requested.
         EXPECT_EQ(url, root["url"].asString());
 
@@ -191,12 +188,13 @@ TEST_F(HttpClientLoadTest, async_post_request_for_existing_resource_succeeds)
     {
         // All endpoint data on httpbin.org is JSON encoded.
         json::Value root;
-        json::Reader reader;
+        json::CharReaderBuilder builder;
+        std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
         // We expect the query to complete successfully
         EXPECT_EQ(core::net::http::Status::ok, response.status);
         // Parsing the body of the response as JSON should succeed.
-        EXPECT_TRUE(reader.parse(response.body, root));
+        EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
         // The url field of the payload should equal the original url we requested.
         EXPECT_EQ(payload, root["data"].asString());
 
diff --git a/tests/http_client_test.cpp b/tests/http_client_test.cpp
index dd37d4f..e7cdd73 100644
--- a/tests/http_client_test.cpp
+++ b/tests/http_client_test.cpp
@@ -144,7 +144,8 @@ TEST(HttpClient, get_request_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter);
@@ -152,7 +153,7 @@ TEST(HttpClient, get_request_for_existing_resource_succeeds)
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // The url field of the payload should equal the original url we requested.
     EXPECT_EQ(url, root["url"].asString());
 }
@@ -174,7 +175,8 @@ TEST(HttpClient, get_request_with_custom_headers_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter);
@@ -183,7 +185,7 @@ TEST(HttpClient, get_request_with_custom_headers_for_existing_resource_succeeds)
     EXPECT_EQ(core::net::http::Status::ok, response.status);
 
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
 
     auto headers = root["headers"];
 
@@ -207,7 +209,8 @@ TEST(HttpClient, empty_header_values_are_handled_correctly)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter);
@@ -216,7 +219,7 @@ TEST(HttpClient, empty_header_values_are_handled_correctly)
     EXPECT_EQ(core::net::http::Status::ok, response.status);
 
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
 
     auto headers = root["headers"];
     EXPECT_EQ(std::string{}, headers["Empty"].asString());
@@ -240,7 +243,8 @@ TEST(HttpClient, get_request_for_existing_resource_guarded_by_basic_auth_succeed
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter);
@@ -248,7 +252,7 @@ TEST(HttpClient, get_request_for_existing_resource_guarded_by_basic_auth_succeed
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // We expect authentication to work.
     EXPECT_TRUE(root["authenticated"].asBool());
     // With the correct user id
@@ -274,7 +278,8 @@ TEST(HttpClient, DISABLED_get_request_for_existing_resource_guarded_by_digest_au
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter);
@@ -282,7 +287,7 @@ TEST(HttpClient, DISABLED_get_request_for_existing_resource_guarded_by_digest_au
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // We expect authentication to work.
     EXPECT_TRUE(root["authenticated"].asBool());
     // With the correct user id
@@ -323,12 +328,13 @@ TEST(HttpClient, async_get_request_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // The url field of the payload should equal the original url we requested.
     EXPECT_EQ(url, root["url"].asString());
 
@@ -362,7 +368,8 @@ TEST(HttpClient, async_get_request_for_existing_resource_guarded_by_basic_authen
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     std::promise<core::net::http::Response> promise;
     auto future = promise.get_future();
@@ -392,7 +399,7 @@ TEST(HttpClient, async_get_request_for_existing_resource_guarded_by_basic_authen
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // We expect authentication to work.
     EXPECT_TRUE(root["authenticated"].asBool());
     // With the correct user id
@@ -416,7 +423,8 @@ TEST(HttpClient, post_request_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter);
@@ -424,7 +432,7 @@ TEST(HttpClient, post_request_for_existing_resource_succeeds)
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // The url field of the payload should equal the original url we requested.
     EXPECT_EQ(payload, root["data"].asString());
 }
@@ -451,10 +459,11 @@ TEST(HttpClient, post_form_request_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ("test", root["form"]["test"].asString());
 }
 
@@ -476,12 +485,13 @@ TEST(HttpClient, post_request_for_file_with_large_chunk_succeeds)
                                 size);
 
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     auto response = request->execute(default_progress_reporter);
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(url, root["url"].asString());
 }
 
@@ -498,12 +508,13 @@ TEST(HttpClient, put_request_for_existing_resource_succeeds)
                                value.size());
 
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     auto response = request->execute(default_progress_reporter);
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(payload.str(), root["data"].asString());
 }
 
@@ -525,12 +536,13 @@ TEST(HttpClient, put_request_for_file_with_large_chunk_succeeds)
                                size);
 
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     auto response = request->execute(default_progress_reporter);
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(url, root["url"].asString());
 }
 
@@ -542,12 +554,13 @@ TEST(HttpClient, del_request_for_existing_resource_succeeds)
     auto request = client->del(http::Request::Configuration::from_uri_as_string(url));
 
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     auto response = request->execute(default_progress_reporter);
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(url, root["url"].asString());
 }
 
@@ -615,7 +628,8 @@ const char* submit() { return "/v1/submit?key=net-cpp-testing"; }
 // for API and endpoint documentation.
 TEST(HttpClient, DISABLED_search_for_location_on_mozillas_location_service_succeeds)
 {
-    json::FastWriter writer;
+    json::StreamWriterBuilder wbuilder;
+    std::unique_ptr<json::StreamWriter> writer(wbuilder.newStreamWriter());
     json::Value search;
     json::Value cell;
     cell["radio"] = "umts";
@@ -642,16 +656,17 @@ TEST(HttpClient, DISABLED_search_for_location_on_mozillas_location_service_succe
             std::string(com::mozilla::services::location::host) +
             com::mozilla::services::location::resources::v1::search();
     auto request = client->post(http::Request::Configuration::from_uri_as_string(url),
-                                writer.write(search),
+                                Json::writeString(wbuilder, search),
                                 http::ContentType::json);
 
     auto response = request->execute(default_progress_reporter);
 
-    json::Reader reader;
+    json::CharReaderBuilder rbuilder;
+    std::unique_ptr<Json::CharReader> reader(rbuilder.newCharReader());
     json::Value result;
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, result));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &result, NULL));
 
     // We cannot be sure that the server has got information for the given
     // cell and wifi ids. For that, we disable the test.
@@ -693,13 +708,14 @@ TEST(HttpClient, DISABLED_submit_of_location_on_mozillas_location_service_succee
 
     submit["items"].append(item);
 
-    json::FastWriter writer;
+    json::StreamWriterBuilder wbuilder;
+    std::unique_ptr<json::StreamWriter> writer(wbuilder.newStreamWriter());
     auto client = http::make_client();
     auto url =
             std::string(com::mozilla::services::location::host) +
             com::mozilla::services::location::resources::v1::submit();
     auto request = client->post(http::Request::Configuration::from_uri_as_string(url),
-                                writer.write(submit),
+                                Json::writeString(wbuilder, submit),
                                 http::ContentType::json);
     auto response = request->execute(default_progress_reporter);
 
diff --git a/tests/http_streaming_client_test.cpp b/tests/http_streaming_client_test.cpp
index 68ad100..7e9faa1 100644
--- a/tests/http_streaming_client_test.cpp
+++ b/tests/http_streaming_client_test.cpp
@@ -156,7 +156,8 @@ TEST(StreamingHttpClient, get_request_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -164,7 +165,7 @@ TEST(StreamingHttpClient, get_request_for_existing_resource_succeeds)
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // The url field of the payload should equal the original url we requested.
     EXPECT_EQ(url, root["url"].asString());
 }
@@ -191,7 +192,8 @@ TEST(StreamingHttpClient, get_request_with_custom_headers_for_existing_resource_
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -200,7 +202,7 @@ TEST(StreamingHttpClient, get_request_with_custom_headers_for_existing_resource_
     EXPECT_EQ(core::net::http::Status::ok, response.status);
 
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
 
     auto headers = root["headers"];
 
@@ -229,7 +231,8 @@ TEST(StreamingHttpClient, empty_header_values_are_handled_correctly)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -238,7 +241,7 @@ TEST(StreamingHttpClient, empty_header_values_are_handled_correctly)
     EXPECT_EQ(core::net::http::Status::ok, response.status);
 
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
 
     auto headers = root["headers"];
     EXPECT_EQ(std::string{}, headers["Empty"].asString());
@@ -267,7 +270,8 @@ TEST(StreamingHttpClient, get_request_for_existing_resource_guarded_by_basic_aut
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -275,7 +279,7 @@ TEST(StreamingHttpClient, get_request_for_existing_resource_guarded_by_basic_aut
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // We expect authentication to work.
     EXPECT_TRUE(root["authenticated"].asBool());
     // With the correct user id
@@ -306,7 +310,8 @@ TEST(StreamingHttpClient, DISABLED_get_request_for_existing_resource_guarded_by_
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -314,7 +319,7 @@ TEST(StreamingHttpClient, DISABLED_get_request_for_existing_resource_guarded_by_
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // We expect authentication to work.
     EXPECT_TRUE(root["authenticated"].asBool());
     // With the correct user id
@@ -361,12 +366,13 @@ TEST(StreamingHttpClient, async_get_request_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // The url field of the payload should equal the original url we requested.
     EXPECT_EQ(url, root["url"].asString());
 
@@ -405,7 +411,8 @@ TEST(StreamingHttpClient, async_get_request_for_existing_resource_guarded_by_bas
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     std::promise<core::net::http::Response> promise;
     auto future = promise.get_future();
@@ -436,7 +443,7 @@ TEST(StreamingHttpClient, async_get_request_for_existing_resource_guarded_by_bas
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // We expect authentication to work.
     EXPECT_TRUE(root["authenticated"].asBool());
     // With the correct user id
@@ -465,7 +472,8 @@ TEST(StreamingHttpClient, post_request_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     // We finally execute the query synchronously and story the response.
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -473,7 +481,7 @@ TEST(StreamingHttpClient, post_request_for_existing_resource_succeeds)
     // We expect the query to complete successfully
     EXPECT_EQ(core::net::http::Status::ok, response.status);
     // Parsing the body of the response as JSON should succeed.
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     // The url field of the payload should equal the original url we requested.
     EXPECT_EQ(payload, root["data"].asString());
 }
@@ -505,10 +513,11 @@ TEST(StreamingHttpClient, post_form_request_for_existing_resource_succeeds)
 
     // All endpoint data on httpbin.org is JSON encoded.
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ("test", root["form"]["test"].asString());
 }
 
@@ -536,10 +545,11 @@ TEST(StreamingHttpClient, post_request_for_file_with_large_chunk_succeeds)
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
   
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(url, root["url"].asString());
 }
 
@@ -569,10 +579,11 @@ TEST(StreamingHttpClient, post_request_for_file_with_large_chunk_with_read_callb
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
   
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(url, root["url"].asString());
 }
 
@@ -596,10 +607,11 @@ TEST(StreamingHttpClient, put_request_for_existing_resource_succeeds)
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
 
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
 
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(payload.str(), root["data"].asString());
 }
 
@@ -627,10 +639,11 @@ TEST(StreamingHttpClient, put_request_for_file_with_large_chunk_succeeds)
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
   
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
   
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(url, root["url"].asString());
 }
 
@@ -660,10 +673,11 @@ TEST(StreamingHttpClient, put_request_for_file_with_large_chunk_with_read_callba
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
   
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
   
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(url, root["url"].asString());
 }
 
@@ -682,10 +696,11 @@ TEST(StreamingHttpClient, del_request_for_existing_resource_succeeds)
     auto response = request->execute(default_progress_reporter, dh->to_data_handler());
 
     json::Value root;
-    json::Reader reader;
+    json::CharReaderBuilder builder;
+    std::unique_ptr<json::CharReader> reader(builder.newCharReader());
   
     EXPECT_EQ(core::net::http::Status::ok, response.status);
-    EXPECT_TRUE(reader.parse(response.body, root));
+    EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
     EXPECT_EQ(url, root["url"].asString());
 }
 
-- 
2.24.1