@@ -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 ;
@@ -439,22 +439,24 @@ class http_response
439
439
// / Extracts the body of the response message as a string value, checking that the content type is a MIME text type.
440
440
// / A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.
441
441
// / </summary>
442
+ // / <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param>
442
443
// / <returns>String containing body of the message.</returns>
443
- pplx::task<utility::string_t > extract_string () const
444
+ pplx::task<utility::string_t > extract_string (bool force = false ) const
444
445
{
445
446
auto impl = _m_impl;
446
- return pplx::create_task (_m_impl->_get_data_available ()).then ([impl](utility::size64_t ) { return impl->_extract_string (); });
447
+ return pplx::create_task (_m_impl->_get_data_available ()).then ([impl, force ](utility::size64_t ) { return impl->_extract_string (force ); });
447
448
}
448
449
449
450
// / <summary>
450
451
// / Extracts the body of the response message into a json value, checking that the content type is application\json.
451
452
// / A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.
452
453
// / </summary>
454
+ // / <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param>
453
455
// / <returns>JSON value from the body of this message.</returns>
454
- pplx::task<json::value> extract_json () const
456
+ pplx::task<json::value> extract_json (bool force = false ) const
455
457
{
456
458
auto impl = _m_impl;
457
- return pplx::create_task (_m_impl->_get_data_available ()).then ([impl](utility::size64_t ) { return impl->_extract_json (); });
459
+ return pplx::create_task (_m_impl->_get_data_available ()).then ([impl, force ](utility::size64_t ) { return impl->_extract_json (force ); });
458
460
}
459
461
460
462
// / <summary>
@@ -807,22 +809,24 @@ class http_request
807
809
// / Extract the body of the request message as a string value, checking that the content type is a MIME text type.
808
810
// / A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.
809
811
// / </summary>
812
+ // / <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param>
810
813
// / <returns>String containing body of the message.</returns>
811
- pplx::task<utility::string_t > extract_string ()
814
+ pplx::task<utility::string_t > extract_string (bool force = false )
812
815
{
813
816
auto impl = _m_impl;
814
- return pplx::create_task (_m_impl->_get_data_available ()).then ([impl](utility::size64_t ) { return impl->_extract_string (); });
817
+ return pplx::create_task (_m_impl->_get_data_available ()).then ([impl, force ](utility::size64_t ) { return impl->_extract_string (force ); });
815
818
}
816
819
817
820
// / <summary>
818
821
// / Extracts the body of the request message into a json value, checking that the content type is application\json.
819
822
// / A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.
820
823
// / </summary>
824
+ // / <param name="force">If true, ignores the Content-Type header and assumes UTF-8.</param>
821
825
// / <returns>JSON value from the body of this message.</returns>
822
- pplx::task<json::value> extract_json () const
826
+ pplx::task<json::value> extract_json (bool force = false ) const
823
827
{
824
828
auto impl = _m_impl;
825
- return pplx::create_task (_m_impl->_get_data_available ()).then ([impl](utility::size64_t ) { return impl->_extract_json (); });
829
+ return pplx::create_task (_m_impl->_get_data_available ()).then ([impl, force ](utility::size64_t ) { return impl->_extract_json (force ); });
826
830
}
827
831
828
832
// / <summary>
0 commit comments