Skip to content

Commit 1ea0279

Browse files
author
MarcoFalke
committedDec 10, 2022
Merge bitcoin#26666: refactor: Deleted unreachable code in httpserver.cpp
8f5c560 refactor: Refactored RequestMethodString function to follow developer notes (JoaoAJMatos) 7fd3b94 refactor: Deleted unreachable code in httpserver.cpp (JoaoAJMatos) Pull request description: Some of the code in httpserver.cpp was unreachable, and didn't follow the developer notes. Continuation of [bitcoin#26570 ](bitcoin#26570) ACKs for top commit: stickies-v: re-ACK [8f5c560](bitcoin@8f5c560) Tree-SHA512: ba8cf4c6dde9e2bb0ca9d63a0de86dfa37b070803dde71ac8384c261045835697a2335652cf5894511b3af8fd99f30e1cbda4e4234815b8b39538ade90fab3f9

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed
 

‎src/httpserver.cpp

+3-11
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,16 @@ std::string RequestMethodString(HTTPRequest::RequestMethod m)
192192
switch (m) {
193193
case HTTPRequest::GET:
194194
return "GET";
195-
break;
196195
case HTTPRequest::POST:
197196
return "POST";
198-
break;
199197
case HTTPRequest::HEAD:
200198
return "HEAD";
201-
break;
202199
case HTTPRequest::PUT:
203200
return "PUT";
204-
break;
205-
default:
201+
case HTTPRequest::UNKNOWN:
206202
return "unknown";
207-
}
203+
} // no default case, so the compiler can warn about missing cases
204+
assert(false);
208205
}
209206

210207
/** HTTP request callback */
@@ -626,19 +623,14 @@ HTTPRequest::RequestMethod HTTPRequest::GetRequestMethod() const
626623
switch (evhttp_request_get_command(req)) {
627624
case EVHTTP_REQ_GET:
628625
return GET;
629-
break;
630626
case EVHTTP_REQ_POST:
631627
return POST;
632-
break;
633628
case EVHTTP_REQ_HEAD:
634629
return HEAD;
635-
break;
636630
case EVHTTP_REQ_PUT:
637631
return PUT;
638-
break;
639632
default:
640633
return UNKNOWN;
641-
break;
642634
}
643635
}
644636

0 commit comments

Comments
 (0)
Please sign in to comment.