Skip to content

Commit 851edaf

Browse files
committed
Code format
1 parent 1a2a6e2 commit 851edaf

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

httplib.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,9 @@ class Server {
465465
Server &Delete(const char *pattern, Handler handler);
466466
Server &Options(const char *pattern, Handler handler);
467467

468-
[[deprecated]] bool set_base_dir(const char *dir, const char *mount_point = nullptr);
469-
bool set_mount_point(const char *mount_point, const char* dir);
468+
[[deprecated]] bool set_base_dir(const char *dir,
469+
const char *mount_point = nullptr);
470+
bool set_mount_point(const char *mount_point, const char *dir);
470471
bool remove_mount_point(const char *mount_point);
471472
void set_file_extension_and_mimetype_mapping(const char *ext,
472473
const char *mime);
@@ -2891,10 +2892,10 @@ inline Server &Server::Options(const char *pattern, Handler handler) {
28912892
}
28922893

28932894
inline bool Server::set_base_dir(const char *dir, const char *mount_point) {
2894-
return set_mount_point(mount_point, dir);
2895+
return set_mount_point(mount_point, dir);
28952896
}
28962897

2897-
inline bool Server::set_mount_point(const char *mount_point, const char* dir) {
2898+
inline bool Server::set_mount_point(const char *mount_point, const char *dir) {
28982899
if (detail::is_dir(dir)) {
28992900
std::string mnt = mount_point ? mount_point : "/";
29002901
if (!mnt.empty() && mnt[0] == '/') {
@@ -2907,10 +2908,10 @@ inline bool Server::set_mount_point(const char *mount_point, const char* dir) {
29072908

29082909
inline bool Server::remove_mount_point(const char *mount_point) {
29092910
for (auto it = base_dirs_.begin(); it != base_dirs_.end(); ++it) {
2910-
if (it->first == mount_point) {
2911-
base_dirs_.erase(it);
2912-
return true;
2913-
}
2911+
if (it->first == mount_point) {
2912+
base_dirs_.erase(it);
2913+
return true;
2914+
}
29142915
}
29152916
return false;
29162917
}
@@ -3228,7 +3229,8 @@ inline bool Server::read_content_core(Stream &strm, bool last_connection,
32283229
return true;
32293230
}
32303231

3231-
inline bool Server::handle_file_request(Request &req, Response &res, bool head) {
3232+
inline bool Server::handle_file_request(Request &req, Response &res,
3233+
bool head) {
32323234
for (const auto &kv : base_dirs_) {
32333235
const auto &mount_point = kv.first;
32343236
const auto &base_dir = kv.second;
@@ -3246,7 +3248,9 @@ inline bool Server::handle_file_request(Request &req, Response &res, bool head)
32463248
detail::find_content_type(path, file_extension_and_mimetype_map_);
32473249
if (type) { res.set_header("Content-Type", type); }
32483250
res.status = 200;
3249-
if (!head && file_request_handler_) { file_request_handler_(req, res); }
3251+
if (!head && file_request_handler_) {
3252+
file_request_handler_(req, res);
3253+
}
32503254
return true;
32513255
}
32523256
}
@@ -3348,7 +3352,10 @@ inline bool Server::routing(Request &req, Response &res, Stream &strm,
33483352
bool last_connection) {
33493353
// File handler
33503354
bool is_head_request = req.method == "HEAD";
3351-
if ((req.method == "GET" || is_head_request) && handle_file_request(req, res, is_head_request)) { return true; }
3355+
if ((req.method == "GET" || is_head_request) &&
3356+
handle_file_request(req, res, is_head_request)) {
3357+
return true;
3358+
}
33523359

33533360
if (detail::expect_content(req)) {
33543361
// Content reader handler

test/test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ TEST(ParseHeaderValueTest, Range) {
201201

202202
TEST(BufferStreamTest, read) {
203203
detail::BufferStream strm1;
204-
Stream& strm = strm1;
204+
Stream &strm = strm1;
205205

206206
EXPECT_EQ(5, strm.write("hello"));
207207

0 commit comments

Comments
 (0)