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

Commit86523b9

Browse files
committed
Added parameters to the client_options; updated the tests.
1 parentd9b40ce commit86523b9

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright (C) 2013 by Glyn Matthews
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#include<igloo/igloo_alt.h>
7+
#include"network/http/v2/client.hpp"
8+
9+
usingnamespaceigloo;
10+
namespacehttp= network::http::v2;
11+
12+
Describe(http_client) {
13+
14+
voidSetUp() {
15+
client_.reset(new http::client{});
16+
}
17+
18+
voidTearDown() {
19+
20+
}
21+
22+
It(gets_a_header_response) {
23+
http::client::request request;
24+
request
25+
.method(http::method::get)
26+
.path("/LICENSE_1_0.txt")
27+
.version("1.1")
28+
.append_header("Host","www.boost.org")
29+
.append_header("User-Agent","cpp-netlib client_test")
30+
.append_header("Connection","close");
31+
auto future_response = client_->head(request);
32+
auto response = future_response.get();
33+
34+
Assert::That(response.version(),Equals("HTTP/1.1"));
35+
Assert::That(response.status(),Equals(http::status::code::ok));
36+
Assert::That(response.status_message(),Equals("OK"));
37+
38+
auto headers = response.headers();
39+
Assert::That(std::begin(headers)->first,Equals("Date"));
40+
}
41+
42+
std::unique_ptr<http::client> client_;
43+
44+
};
45+
46+
int
47+
main(int argc,char *argv[]) {
48+
returnTestRunner::RunAllTests(argc,const_cast<constchar **>(argv));
49+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (C) 2013 by Glyn Matthews
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#include<gtest/gtest.h>
7+
#include"network/http/v2/client/client.hpp"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp