NetworkMockOnRequestHandler
public struct NetworkMockOnRequestHandler
A handler for verifying outgoing requests.
-
Undocumented
Declaration
Swift
public typealias OnRequest<HTTPBody> = @Sendable (_ request: URLRequest, _ httpBody: HTTPBody?) -> Void -
Creates a new request handler using the given
HTTPBodytype, which can be anyDecodable.Declaration
Swift
public init<HTTPBody>(httpBodyType: HTTPBody.Type?, callback: @escaping OnRequest<HTTPBody>) where HTTPBody : DecodableParameters
httpBodyTypeThe decodable type to use for parsing the request body.
callbackThe callback which will be called just before the request executes.
-
Creates a new request handler using the given callback to call on request without parsing the body arguments.
Declaration
Swift
public init(requestCallback: @escaping @Sendable (_ request: URLRequest) -> Void)Parameters
requestCallbackThe callback which will be executed just before the request executes, containing the request.
-
Creates a new request handler using the given callback to call on request without parsing the body arguments and without passing the request.
Declaration
Swift
public init(callback: @escaping @Sendable () -> Void)Parameters
callbackThe callback which will be executed just before the request executes.
-
Creates a new request handler using the given callback to call on request.
Declaration
Swift
public init(jsonDictionaryCallback: @escaping @Sendable (_ request: URLRequest, _ httpBodyArguments: [String : Any]?) -> Void)Parameters
jsonDictionaryCallbackThe callback that executes just before the request executes, containing the HTTP Body Arguments as a JSON Object Dictionary.
-
Creates a new request handler using the given callback to call on request.
Declaration
Swift
public init(jsonArrayCallback: @escaping @Sendable (_ request: URLRequest, _ httpBodyArguments: [[String : Any]]?) -> Void)Parameters
jsonDictionaryCallbackThe callback that executes just before the request executes, containing the HTTP Body Arguments as a JSON Object Array.
View on GitHub