Repository: square/okhttp
File: okhttp/src/commonJvmAndroid/kotlin/okhttp3/Request.kt (Kotlin)

Code before:
      }
    }

    open fun get(): Builder = method("GET", null)

    open fun head(): Builder = method("HEAD", null)

    open fun post(body: RequestBody): Builder = method("POST", body)

    @JvmOverloads
    open fun delete(body: RequestBody? = RequestBody.EMPTY): Builder = method("DELETE", body)

    open fun put(body: RequestBody): Builder = method("PUT", body)

    open fun patch(body: RequestBody): Builder = method("PATCH", body)

    open fun query(body: RequestBody): Builder = method("QUERY", body)

    open fun method(
      method: String,
      body: RequestBody?,
    ): Builder =
      apply {
        require(method.isNotEmpty()) {
          "method.isEmpty() == true"
        }
        if (body == null) {
          require(!HttpMethod.requiresRequestBody(method)) {
            "method $method must have a request body."
          }
        } else {
          require(HttpMethod.permitsRequestBody(method)) {
            "method $method must not have a request body."
          }
        }
        this.method = method
        this.body = body
      }

    /**
     * Attaches [tag] to the request using [T] as a key. Tags can be read from a request using
     * [Request.tag]. Use null to remove any existing tag assigned for [T].
     *
     * Use this API to attach timing, debugging, or other application data to a request so that
     * you may read it in interceptors, event listeners, or callbacks.
     */
    @JvmName("reifiedTag")
    inline fun <reified T : Any> tag(tag: T?): Builder = tag(T::class, tag)

    /**
     * Attaches [tag] to the request using [type] as a key. Tags can be read from a request using

Review comment (suggestion):
We shouldn’t be using MD5 unless we need to for compatibility with other systems. Only SHA256 for new uses

Code after:
      }
    }

    open fun get(): Builder = method("GET", null)

    open fun head(): Builder = method("HEAD", null)

    open fun post(body: RequestBody): Builder = method("POST", body)

    @JvmOverloads
    open fun delete(body: RequestBody? = RequestBody.EMPTY): Builder = method("DELETE", body)

    open fun put(body: RequestBody): Builder = method("PUT", body)

    open fun patch(body: RequestBody): Builder = method("PATCH", body)

    /**
     * Sets this request's method to `QUERY`.
     *
     * By default, `QUERY` requests are not cached. You can use [cacheUrlOverride] to specify
     * how to cache them.
     *
     * A typical use case is to hash the request body:
     *
     * ```kotlin
     *     val hashingSink = HashingSink.md5(blackholeSink())
     *     hashingSink.buffer().use {
     *       body.writeTo(it)
     *     }
     *     val hash = hashingSink.hash.hex()
     *     val query = Request
     *         .Builder()
     *         .query(body)
     *         .url("https://example.com/query")
     *         .cacheUrlOverride("https://example.com/query/$hash".toHttpUrl())
     *         .build()
     * ```
     *
     * @see cacheUrlOverride
     */
    open fun query(body: RequestBody): Builder = method("QUERY", body)

    open fun method(
      method: String,
      body: RequestBody?,
    ): Builder =
      apply {
        require(method.isNotEmpty()) {
          "method.isEmpty() == true"
        }
        if (body == null) {