Skip to content

Commit 837941c

Browse files
committed
update default values for status check
1 parent 28e8fe7 commit 837941c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Sources/async-http-client/proxy/http/Proxy.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public extension Http{
9595
query : Query? = nil,
9696
headers : Headers? = nil,
9797
retry : UInt = 1,
98-
validate : [Http.Validate] = [.status(.const(200))],
98+
validate : [Http.Validate] = [.status(.const())], /// default 200
9999
taskDelegate: ITaskDelegate? = nil
100100
) async throws
101101
-> Http.Response<T> where T: Decodable
@@ -125,7 +125,7 @@ public extension Http{
125125
query : Query? = nil,
126126
headers : Headers? = nil,
127127
retry : UInt = 1,
128-
validate : [Http.Validate] = [.status(.const(200))],
128+
validate : [Http.Validate] = [.status(.const())], /// default 200
129129
taskDelegate: ITaskDelegate? = nil
130130
) async throws
131131
-> Http.Response<T> where T: Decodable
@@ -157,7 +157,7 @@ public extension Http{
157157
query : Query? = nil,
158158
headers : Headers? = nil,
159159
retry : UInt = 1,
160-
validate : [Http.Validate] = [.status(.range(200..<300))],
160+
validate : [Http.Validate] = [.status(.const())], /// default 200
161161
taskDelegate: ITaskDelegate? = nil
162162
) async throws
163163
-> Http.Response<T> where T: Decodable
@@ -178,7 +178,7 @@ public extension Http{
178178
public func send<T>(
179179
with request : URLRequest,
180180
retry strategy : RetryService.Strategy = .exponential(),
181-
_ validate : [Http.Validate] = [.status(.const(200))],
181+
_ validate : [Http.Validate] = [.status(.const())], /// default 200
182182
_ taskDelegate: ITaskDelegate? = nil
183183
) async throws -> Http.Response<T> where T : Decodable
184184
{

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public extension Http.Validate{
1515
public typealias Predicate = (Int) -> Bool
1616

1717
/// Validate by exact value
18-
case const(Int)
18+
case const(Int = 200)
1919

2020
/// Validate by range
21-
case range(Range<Int>)
21+
case range(Range<Int> = 200..<300)
2222

2323
/// Validate by predicate func if you need some specific logic
2424
case predicate(Predicate)

0 commit comments

Comments
 (0)