Commit 17484fad by Dave Syer

Use Enum.valueOf() instead of case switch

Fixes gh-156
parent 6e078a88
......@@ -168,26 +168,20 @@ public class RibbonRoutingFilter extends ZuulFilter {
return requestEntity;
}
Verb getVerb(HttpServletRequest request) {
private Verb getVerb(HttpServletRequest request) {
String sMethod = request.getMethod();
return getVerb(sMethod);
}
Verb getVerb(String sMethod) {
private Verb getVerb(String sMethod) {
if (sMethod == null)
return Verb.GET;
sMethod = sMethod.toLowerCase();
if (sMethod.equals("post"))
return Verb.POST;
if (sMethod.equals("put"))
return Verb.PUT;
if (sMethod.equals("delete"))
return Verb.DELETE;
if (sMethod.equals("options"))
return Verb.OPTIONS;
if (sMethod.equals("head"))
return Verb.HEAD;
return Verb.GET;
try {
return Verb.valueOf(sMethod.toUpperCase());
}
catch (IllegalArgumentException e) {
return Verb.GET;
}
}
private void setResponse(HttpResponse resp) throws ClientException, IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment