Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 402: Payment Required #322

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions turbo/src/main/kotlin/dev/hotwire/turbo/errors/HttpError.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ sealed interface HttpError : TurboVisitError {
override val reasonPhrase = "Unauthorized"
}

data object PaymentRequired : ClientError {
override val statusCode = 402
override val reasonPhrase = "Payment Required"
}

data object Forbidden : ClientError {
override val statusCode = 403
override val reasonPhrase = "Forbidden"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class HttpErrorTest : BaseUnitTest() {
val errors = listOf(
400 to ClientError.BadRequest,
401 to ClientError.Unauthorized,
402 to ClientError.PaymentRequired,
403 to ClientError.Forbidden,
404 to ClientError.NotFound,
405 to ClientError.MethodNotAllowed,
Expand Down
Loading