Skip to content

Commit

Permalink
Merge pull request #214 from softwaremill/status-texts
Browse files Browse the repository at this point in the history
Added map with status texts
  • Loading branch information
adamw authored Sep 7, 2022
2 parents 6e0d2f7 + 5ea9f0a commit c4a7bc3
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions core/src/main/scala/sttp/model/StatusText.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package sttp.model

import sttp.model.StatusCode._

case class StatusText(text: String)

object StatusText {

private val statusTexts: Map[StatusCode, String] = Map(
Continue -> "Continue",
SwitchingProtocols -> "Switching Protocols",
Processing -> "Processing",
EarlyHints -> "Early Hints",
Ok -> "Ok",
Created -> "Created",
Accepted -> "Accepted",
NonAuthoritativeInformation -> "Non Authoritative Information",
NoContent -> "No Content",
ResetContent -> "Reset Content",
PartialContent -> "Partial Content",
MultiStatus -> "Multi Status",
AlreadyReported -> "Already Reported",
ImUsed -> "Im Used",
MultipleChoices -> "Multiple Choices",
MovedPermanently -> "Moved Permanently",
Found -> "Found",
SeeOther -> "See Other",
NotModified -> "Not Modified",
UseProxy -> "Use Proxy",
TemporaryRedirect -> "Temporary Redirect",
PermanentRedirect -> "Permanent Redirect",
BadRequest -> "Bad Request",
Unauthorized -> "Unauthorized",
PaymentRequired -> "Payment Required",
Forbidden -> "Forbidden",
NotFound -> "Not Found",
MethodNotAllowed -> "Method Not Allowed",
NotAcceptable -> "Not Acceptable",
ProxyAuthenticationRequired -> "Proxy Authentication Required",
RequestTimeout -> "Request Timeout",
Conflict -> "Conflict",
Gone -> "Gone",
LengthRequired -> "Length Required",
PreconditionFailed -> "Precondition Failed",
PayloadTooLarge -> "Payload Too Large",
UriTooLong -> "Uri Too Long",
UnsupportedMediaType -> "Unsupported MediaType",
RangeNotSatisfiable -> "Range Not Satisfiable",
ExpectationFailed -> "Expectation Failed",
MisdirectedRequest -> "Misdirected Request",
UnprocessableEntity -> "Unprocessable Entity",
Locked -> "Locked",
FailedDependency -> "Failed Dependency",
UpgradeRequired -> "Upgrade Required",
PreconditionRequired -> "Precondition Required",
TooManyRequests -> "Too Many Requests",
RequestHeaderFieldsTooLarge -> "RequestHeader Fields Too Large",
UnavailableForLegalReasons -> "Unavailable For Legal Reasons",
InternalServerError -> "Internal Server Error",
NotImplemented -> "Not Implemented",
BadGateway -> "Bad Gateway",
ServiceUnavailable -> "Service Unavailable",
GatewayTimeout -> "Gateway Timeout",
HttpVersionNotSupported -> "Http Version Not Supported",
VariantAlsoNegotiates -> "Variant Also Negotiates",
InsufficientStorage -> "Insufficient Storage",
LoopDetected -> "Loop Detected",
NotExtended -> "Not Extended",
NetworkAuthenticationRequired -> "Network Authentication Required"
)

def default(statusCode: StatusCode): Option[String] =
statusTexts.get(statusCode)
}

0 comments on commit c4a7bc3

Please sign in to comment.