commonMain.aws.smithy.kotlin.runtime.http.HttpMethod.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-jvm Show documentation
Show all versions of http-jvm Show documentation
HTTP core for Smithy clients and services generated by smithy-kotlin
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.smithy.kotlin.runtime.http
/**
* Represents an HTTP verb
*/
public enum class HttpMethod {
GET,
POST,
PUT,
PATCH,
DELETE,
HEAD,
OPTIONS,
;
public companion object {
/**
* Parse from a raw string representation of an HTTP method (e.g. "get")
* @return [HttpMethod] for the given string
* @throws IllegalArgumentException if the method is unknown
*/
public fun parse(method: String): HttpMethod = when (method.uppercase()) {
GET.name -> GET
POST.name -> POST
PUT.name -> PUT
PATCH.name -> PATCH
DELETE.name -> DELETE
HEAD.name -> HEAD
OPTIONS.name -> OPTIONS
else -> throw IllegalArgumentException("unknown HTTP method: $method")
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy