simplify string utilities
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "boost/algorithm/string.hpp"
|
||||
#include "boost/filesystem/fstream.hpp"
|
||||
#include "boost/filesystem/operations.hpp"
|
||||
|
||||
@@ -299,7 +300,7 @@ TEST(ClientTest, Post) {
|
||||
|
||||
static bfs::path GenerateTempFile(const std::string& data) {
|
||||
try {
|
||||
bfs::path path = bfs::temp_directory_path() / webcc::random_string(10);
|
||||
bfs::path path = bfs::temp_directory_path() / webcc::RandomString(10);
|
||||
|
||||
bfs::ofstream ofs;
|
||||
ofs.open(path, std::ios::binary);
|
||||
@@ -419,24 +420,24 @@ TEST(ClientTest, KeepAlive) {
|
||||
// Keep-Alive by default.
|
||||
auto r = session.Send(webcc::RequestBuilder{}.Get(url)());
|
||||
|
||||
EXPECT_TRUE(webcc::iequals(r->GetHeader("Connection"), "Keep-alive"));
|
||||
EXPECT_TRUE(boost::iequals(r->GetHeader("Connection"), "Keep-alive"));
|
||||
|
||||
// Close by setting Connection header directly.
|
||||
r = session.Send(webcc::RequestBuilder{}.Get(url).
|
||||
Header("Connection", "Close")
|
||||
());
|
||||
|
||||
EXPECT_TRUE(webcc::iequals(r->GetHeader("Connection"), "Close"));
|
||||
EXPECT_TRUE(boost::iequals(r->GetHeader("Connection"), "Close"));
|
||||
|
||||
// Close by using request builder.
|
||||
r = session.Send(webcc::RequestBuilder{}.Get(url).KeepAlive(false)());
|
||||
|
||||
EXPECT_TRUE(webcc::iequals(r->GetHeader("Connection"), "Close"));
|
||||
EXPECT_TRUE(boost::iequals(r->GetHeader("Connection"), "Close"));
|
||||
|
||||
// Keep-Alive explicitly by using request builder.
|
||||
r = session.Send(webcc::RequestBuilder{}.Get(url).KeepAlive(true)());
|
||||
|
||||
EXPECT_TRUE(webcc::iequals(r->GetHeader("Connection"), "Keep-alive"));
|
||||
EXPECT_TRUE(boost::iequals(r->GetHeader("Connection"), "Keep-alive"));
|
||||
|
||||
} catch (const webcc::Error& error) {
|
||||
std::cerr << error << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user