Forráskód Böngészése

Merge pull request #82 from FZachlod/master

add http-patch method for http actions
Jason 9 éve
szülő
commit
d20521f8c9

+ 1 - 1
src/main/java/password/pwm/config/ActionConfiguration.java

@@ -34,7 +34,7 @@ import java.util.Map;
 public class ActionConfiguration implements Serializable {
 
     public enum Type { webservice, ldap }
-    public enum WebMethod { delete, get, post, put }
+    public enum WebMethod { delete, get, post, put, patch }
     public enum LdapMethod { replace, add, remove }
 
     private String name;

+ 1 - 0
src/main/java/password/pwm/http/HttpMethod.java

@@ -27,6 +27,7 @@ public enum HttpMethod {
     GET(true),
     DELETE(false),
     PUT(false),
+    PATCH(false),
 
     ;
 

+ 7 - 0
src/main/java/password/pwm/http/client/PwmHttpClient.java

@@ -245,6 +245,13 @@ public class PwmHttpClient {
                 }
                 break;
 
+            case PATCH:
+                httpRequest = new HttpPatch(clientRequest.getUrl());
+                if (clientRequest.getBody() != null && !clientRequest.getBody().isEmpty()) {
+                    ((HttpPatch) httpRequest).setEntity(new StringEntity(requestBody, PwmConstants.DEFAULT_CHARSET));
+                }
+                break;
+
             case GET:
                 httpRequest = new HttpGet(clientRequest.getUrl());
                 break;

+ 2 - 1
src/main/webapp/public/resources/js/configeditor-settings.js

@@ -1398,7 +1398,8 @@ ActionHandler.httpMethodOptions = [
     { label: "Delete", value: "delete" },
     { label: "Get", value: "get" },
     { label: "Post", value: "post" },
-    { label: "Put", value: "put" }
+    { label: "Put", value: "put" },
+    { label: "Patch", value: "patch" }
 ];
 ActionHandler.ldapMethodOptions = [
     { label: "Replace (Remove all existing values)", value: "replace" },