@@ -224,8 +224,8 @@ class http_msg_base
224
224
_ASYNCRTIMP void set_body (concurrency::streams::istream instream, utility::string_t contentType);
225
225
_ASYNCRTIMP void set_body (concurrency::streams::istream instream, utility::size64_t contentLength, utility::string_t contentType);
226
226
227
- _ASYNCRTIMP utility::string_t _extract_string ();
228
- _ASYNCRTIMP json::value _extract_json ();
227
+ _ASYNCRTIMP utility::string_t _extract_string (bool force = false );
228
+ _ASYNCRTIMP json::value _extract_json (bool force = false );
229
229
_ASYNCRTIMP std::vector<unsigned char > _extract_vector ();
230
230
231
231
virtual _ASYNCRTIMP utility::string_t to_string () const ;
@@ -445,22 +445,24 @@ class http_response
445
445
// / Extracts the body of the response message as a string value, checking that the content type is a MIME text type.
446
446
// / A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.
447
447
// / </summary>
448
+ // / <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param>
448
449
// / <returns>String containing body of the message.</returns>
449
- pplx::task<utility::string_t > extract_string () const
450
+ pplx::task<utility::string_t > extract_string (bool force = false ) const
450
451
{
451
452
auto impl = _m_impl;
452
- return pplx::create_task (_m_impl->_get_data_available ()).then ([impl](utility::size64_t ) { return impl->_extract_string (); });
453
+ return pplx::create_task (_m_impl->_get_data_available ()).then ([impl, force ](utility::size64_t ) { return impl->_extract_string (force ); });
453
454
}
454
455
455
456
// / <summary>
456
457
// / Extracts the body of the response message into a json value, checking that the content type is application\json.
457
458
// / A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.
458
459
// / </summary>
460
+ // / <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param>
459
461
// / <returns>JSON value from the body of this message.</returns>
460
- pplx::task<json::value> extract_json () const
462
+ pplx::task<json::value> extract_json (bool force = false ) const
461
463
{
462
464
auto impl = _m_impl;
463
- return pplx::create_task (_m_impl->_get_data_available ()).then ([impl](utility::size64_t ) { return impl->_extract_json (); });
465
+ return pplx::create_task (_m_impl->_get_data_available ()).then ([impl, force ](utility::size64_t ) { return impl->_extract_json (force ); });
464
466
}
465
467
466
468
// / <summary>
@@ -826,22 +828,24 @@ class http_request
826
828
// / Extract the body of the request message as a string value, checking that the content type is a MIME text type.
827
829
// / A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.
828
830
// / </summary>
831
+ // / <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param>
829
832
// / <returns>String containing body of the message.</returns>
830
- pplx::task<utility::string_t > extract_string ()
833
+ pplx::task<utility::string_t > extract_string (bool force = false )
831
834
{
832
835
auto impl = _m_impl;
833
- return pplx::create_task (_m_impl->_get_data_available ()).then ([impl](utility::size64_t ) { return impl->_extract_string (); });
836
+ return pplx::create_task (_m_impl->_get_data_available ()).then ([impl, force ](utility::size64_t ) { return impl->_extract_string (force ); });
834
837
}
835
838
836
839
// / <summary>
837
840
// / Extracts the body of the request message into a json value, checking that the content type is application\json.
838
841
// / A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.
839
842
// / </summary>
843
+ // / <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param>
840
844
// / <returns>JSON value from the body of this message.</returns>
841
- pplx::task<json::value> extract_json () const
845
+ pplx::task<json::value> extract_json (bool force = false ) const
842
846
{
843
847
auto impl = _m_impl;
844
- return pplx::create_task (_m_impl->_get_data_available ()).then ([impl](utility::size64_t ) { return impl->_extract_json (); });
848
+ return pplx::create_task (_m_impl->_get_data_available ()).then ([impl, force ](utility::size64_t ) { return impl->_extract_json (force ); });
845
849
}
846
850
847
851
// / <summary>
0 commit comments