Skip to content

Commit 2131825

Browse files
committed
Expressible for .const() status validation
1 parent ebf6f4c commit 2131825

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Network layer for running requests like GET, POST, PUT, DELETE etc customizable
2323

2424
## 1. Use
2525
```swift
26-
try await Http.Get.from(url, retry: 5)
26+
try await Http.Get.from(url, retry: 5, validate: [.status(200)])
2727
```
2828
```swift
2929
try await Http.Post.from(url, taskDelegate : TaskDelegate())

Sources/async-http-client/validate/type/Status.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ public extension Http.Validate{
2626
}
2727
}
2828

29+
/// A type that can be initialized with an integer literal.
30+
extension Http.Validate.Status: ExpressibleByIntegerLiteral {
31+
/// Creates an instance initialized to the specified integer value.
32+
public init(integerLiteral value: Int) {
33+
self = .const(value)
34+
}
35+
}
36+
2937
public extension Http.Validate.Status{
3038

3139
/// Validate status

0 commit comments

Comments
 (0)