APIStub
open class APIStub
APIStub instance that is used to represent stubbed response. Any properties of this class is presented to serialization classes as if they would be received by URL loading system.
-
URLRequestobject to use when request is being stubbed.Declaration
Swift
open var request: URLRequest? -
HTTPURLResponseto use when request is being stubbed.Declaration
Swift
open var response: HTTPURLResponse? -
Datato use when request is being stubbed. This property is ignored forDownloadAPIRequest.Declaration
Swift
open var data: Data? -
Error to use when request is being stubbed.
Declaration
Swift
open var error: Error? -
File URL to use when stubbing
DownloadAPIRequest. This property is ignored forAPIRequestandUploadAPIRequest.Declaration
Swift
open var fileURL: URL? -
Delay before stub is executed
Declaration
Swift
open var stubDelay: TimeInterval -
When this property is set to true, stub will be activated. Defaults to false.
Declaration
Swift
open var isEnabled: Bool -
Creates
APIStubinstance forAPIRequestandUploadAPIRequest.Declaration
Swift
public init(request: URLRequest? = nil, response: HTTPURLResponse? = nil, data: Data? = nil, error: Error? = nil)Parameters
requestURLRequestobject ot use when request is being stubbed. Defaults to nil.responseHTTPURLResponseobject to use when request is being stubbed. Defaults to nil.dataDataobject to use when request is being stubbed. Defaults to nil.errorErrorto use when request is being stubbed. Defaults to nil. -
Creates
APIStubinstance forDownloadAPIRequest.Declaration
Swift
public init(request: URLRequest? = nil, response: HTTPURLResponse? = nil, fileURL: URL? = nil, error: Error? = nil)Parameters
requestURLRequestobject ot use when request is being stubbed. Defaults to nil.responseHTTPURLResponseobject to use when request is being stubbed. Defaults to nil.fileURLFile URL of downloaded file to use when request is being stubbed. Defaults to nil.
errorErrorto use when request is being stubbed. Defaults to nil.
View on GitHub
Install in Dash
APIStub Class Reference