Skip to content

Commit 7c28b01

Browse files
MarcoFalkePastaPastaPasta
authored andcommitted
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
1 parent 478fe51 commit 7c28b01

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/httpserver.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,16 @@ std::string RequestMethodString(HTTPRequest::RequestMethod m)
190190
switch (m) {
191191
case HTTPRequest::GET:
192192
return "GET";
193-
break;
194193
case HTTPRequest::POST:
195194
return "POST";
196-
break;
197195
case HTTPRequest::HEAD:
198196
return "HEAD";
199-
break;
200197
case HTTPRequest::PUT:
201198
return "PUT";
202-
break;
203-
default:
199+
case HTTPRequest::UNKNOWN:
204200
return "unknown";
205-
}
201+
} // no default case, so the compiler can warn about missing cases
202+
assert(false);
206203
}
207204

208205
/** HTTP request callback */
@@ -623,19 +620,14 @@ HTTPRequest::RequestMethod HTTPRequest::GetRequestMethod() const
623620
switch (evhttp_request_get_command(req)) {
624621
case EVHTTP_REQ_GET:
625622
return GET;
626-
break;
627623
case EVHTTP_REQ_POST:
628624
return POST;
629-
break;
630625
case EVHTTP_REQ_HEAD:
631626
return HEAD;
632-
break;
633627
case EVHTTP_REQ_PUT:
634628
return PUT;
635-
break;
636629
default:
637630
return UNKNOWN;
638-
break;
639631
}
640632
}
641633

0 commit comments

Comments
 (0)