/*
 * Copyright (C) 2014 Square, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.squareup.okhttp.internal.http;

public final class HttpMethod {
  public static boolean invalidatesCache(String method) {
    return method.equals("POST")
        || method.equals("PATCH")
        || method.equals("PUT")
        || method.equals("DELETE");
  }

  public static boolean requiresRequestBody(String method) {
    return method.equals("POST")
        || method.equals("PUT")
        || method.equals("PATCH");
  }

  public static boolean permitsRequestBody(String method) {
    return requiresRequestBody(method)
        || method.equals("DELETE"); // Permitted as spec is ambiguous.
  }

  private HttpMethod() {
  }
}

@@ -861,17 +861,64 @@
 DELETE%22)
-;
+%0A        %7C%7C method.equals(%22MOVE%22);     // WebDAV
 %0A  %7D%0A%0A  
@@ -1074,17 +1074,151 @@
 %22PATCH%22)
-;
+%0A        %7C%7C method.equals(%22PROPPATCH%22) // WebDAV%0A        %7C%7C method.equals(%22REPORT%22);   // CalDAV/CardDAV (defined in WebDAV Versioning)
 %0A  %7D%0A%0A  
@@ -1348,17 +1348,19 @@
 DELETE%22)
-;
+   
  // Perm
@@ -1387,16 +1387,294 @@
 iguous.%0A
+        %7C%7C method.equals(%22PROPFIND%22)  // (WebDAV) without body: request %3Callprop/%3E%0A        %7C%7C method.equals(%22MKCOL%22)     // (WebDAV) may contain a body, but behaviour is unspecified%0A        %7C%7C method.equals(%22LOCK%22);     // (WebDAV) body: create lock, without body: refresh lock%0A
   %7D%0A%0A  p

Add support for WebDAV HTTP methods (RFC 4918)