Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit82bba85

Browse files
committed
Making client_get_streaming_test.cpp build.
1 parent8e8b14e commit82bba85

File tree

3 files changed

+29
-34
lines changed

3 files changed

+29
-34
lines changed

‎boost/network/protocol/http/message/directives/status.hpp‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,16 @@
1515

1616
namespaceboost {namespacenetwork {namespacehttp {
1717

18-
template<classString>
1918
structstatus_directive {
20-
21-
status_directive(Stringconst & s)
22-
: status_(s)
23-
{}
24-
25-
voidoperator()(response_base & response) {
26-
response.set_status(status_);
27-
}
19+
explicitstatus_directive(std::stringconst & s);
20+
voidoperator()(response_base & response)const;
2821

2922
protected:
30-
31-
String status_;
32-
23+
std::string status_;
3324
};
3425

35-
template<classString>
36-
inline status_directive<String>status(Stringconst & response) {
37-
return status_directive<String>(response);
26+
inline status_directivestatus(std::stringconst & response) {
27+
returnstatus_directive(response);
3828
}
3929

4030
}// namespace http

‎boost/network/protocol/http/message/wrappers/status.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace impl {
1616
structstatus_wrapper {
1717
explicitstatus_wrapper(response_base & response_);
1818
operatorstd::string ()const;
19+
operatoruint16_t ()const;
1920
private:
2021
response_base & response_;
2122
};

‎libs/network/test/http/client_get_streaming_test.cpp‎

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include<boost/network/include/http/client.hpp>
88
#include<boost/test/unit_test.hpp>
99
#include<iostream>
10-
#include"client_types.hpp"
1110

1211
namespacenet= boost::network;
1312
namespacehttp= boost::network::http;
@@ -26,23 +25,28 @@ struct body_handler {
2625
};
2726

2827

29-
BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_streaming_test, client, async_only_client_types) {
30-
typename client::requestrequest("http://www.boost.org");
31-
typename client::response response;
32-
typename client::string_type body_string;
33-
typename client::string_type dummy_body;
34-
body_handlerhandler_instance(body_string);
35-
{
36-
client client_;
37-
BOOST_CHECK_NO_THROW( response = client_.get(request, http::_body_handler=handler_instance) );
38-
typename net::headers_range<typename client::response>::type range =headers(response)["Content-Type"];
39-
BOOST_CHECK ( !boost::empty(range) );
40-
BOOST_CHECK_EQUAL (body(response).size(),0u );
41-
BOOST_CHECK_EQUAL ( response.version().substr(0,7),std::string("HTTP/1.") );
42-
BOOST_CHECK_EQUAL ( response.status(),200u );
43-
BOOST_CHECK_EQUAL ( response.status_message(),std::string("OK") );
44-
dummy_body =body(response);
45-
}
46-
BOOST_CHECK ( dummy_body ==typenameclient::string_type() );
28+
BOOST_AUTO_TEST_CASE(http_client_get_streaming_test) {
29+
http::client::requestrequest("http://www.boost.org");
30+
http::client::response response;
31+
std::string body_string;
32+
std::string dummy_body;
33+
body_handlerhandler_instance(body_string);
34+
{
35+
http::client client_;
36+
BOOST_CHECK_NO_THROW( response = client_.get(request, handler_instance) );
37+
net::headers_wrapper::range_type range =headers(response)["Content-Type"];
38+
BOOST_CHECK ( !boost::empty(range) );
39+
BOOST_CHECK_EQUAL (body(response).size(),0u );
40+
std::string version_, status_message_;
41+
boost::uint16_t status_;
42+
version_ =version(response);
43+
status_ =status(response);
44+
status_message_ =status_message(response);
45+
BOOST_CHECK_EQUAL ( version_.substr(0,7),std::string("HTTP/1.") );
46+
BOOST_CHECK_EQUAL ( status_,200u );
47+
BOOST_CHECK_EQUAL ( status_message_,std::string("OK") );
48+
dummy_body =body(response);
49+
}
50+
BOOST_CHECK ( dummy_body ==std::string() );
4751
}
4852

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp