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 { ...@@ -168,26 +168,20 @@ public class RibbonRoutingFilter extends ZuulFilter {
return requestEntity; return requestEntity;
} }
Verb getVerb(HttpServletRequest request) { private Verb getVerb(HttpServletRequest request) {
String sMethod = request.getMethod(); String sMethod = request.getMethod();
return getVerb(sMethod); return getVerb(sMethod);
} }
Verb getVerb(String sMethod) { private Verb getVerb(String sMethod) {
if (sMethod == null) if (sMethod == null)
return Verb.GET; return Verb.GET;
sMethod = sMethod.toLowerCase(); try {
if (sMethod.equals("post")) return Verb.valueOf(sMethod.toUpperCase());
return Verb.POST; }
if (sMethod.equals("put")) catch (IllegalArgumentException e) {
return Verb.PUT; return Verb.GET;
if (sMethod.equals("delete")) }
return Verb.DELETE;
if (sMethod.equals("options"))
return Verb.OPTIONS;
if (sMethod.equals("head"))
return Verb.HEAD;
return Verb.GET;
} }
private void setResponse(HttpResponse resp) throws ClientException, IOException { 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