Merge bitcoin/bitcoin#26666: refactor: Deleted unreachable code in httpserver.cpp

8f5c560e11a9f3c7c5877f444caa605bdc296e81 refactor: Refactored RequestMethodString function to follow developer notes (JoaoAJMatos)
7fd3b9491b0e553aa7d60a68bda82968a79da8f5 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 [#26570 ](https://github.com/bitcoin/bitcoin/pull/26570)

ACKs for top commit:
  stickies-v:
    re-ACK [8f5c560](8f5c560e11)

Tree-SHA512: ba8cf4c6dde9e2bb0ca9d63a0de86dfa37b070803dde71ac8384c261045835697a2335652cf5894511b3af8fd99f30e1cbda4e4234815b8b39538ade90fab3f9
This commit is contained in:
MarcoFalke 2022-12-10 13:03:19 +01:00 committed by pasta
parent 478fe51ead
commit 7c28b01c78
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -190,19 +190,16 @@ std::string RequestMethodString(HTTPRequest::RequestMethod m)
switch (m) {
case HTTPRequest::GET:
return "GET";
break;
case HTTPRequest::POST:
return "POST";
break;
case HTTPRequest::HEAD:
return "HEAD";
break;
case HTTPRequest::PUT:
return "PUT";
break;
default:
case HTTPRequest::UNKNOWN:
return "unknown";
}
} // no default case, so the compiler can warn about missing cases
assert(false);
}
/** HTTP request callback */
@ -623,19 +620,14 @@ HTTPRequest::RequestMethod HTTPRequest::GetRequestMethod() const
switch (evhttp_request_get_command(req)) {
case EVHTTP_REQ_GET:
return GET;
break;
case EVHTTP_REQ_POST:
return POST;
break;
case EVHTTP_REQ_HEAD:
return HEAD;
break;
case EVHTTP_REQ_PUT:
return PUT;
break;
default:
return UNKNOWN;
break;
}
}