FHIRRequestHandler
public protocol FHIRRequestHandler
Protocol for different request/response handlers.
TODO: should add ResponseType associated type as soon as those can be constrained (SE-0142 – Swift 4?).
-
The HTTP method of the request.
Declaration
Swift
var method: FHIRRequestMethod -
Headers to be used on the request.
Declaration
Swift
var headers: FHIRRequestHeaders -
Request parameters to pass along.
Declaration
Swift
var parameters: FHIRRequestParameters -
Request options to pass along.
Declaration
Swift
var options: FHIRRequestOption -
The receiver may hold on to a resource that supplies the request’s body data.
Declaration
Swift
var resource: Resource? -
Designated initializer.
Declaration
Swift
init(_ method: FHIRRequestMethod, resource: Resource?)
-
Add the given headers to the request, overwriting existing headers.
Declaration
Swift
func add(headers inHeaders: FHIRRequestHeaders)Parameters
headersThe headers to add to the receiver
-
Give the receiver a chance to prepare/alter the URL request.
For example, this method will tell the FHIRRequestMethod instance to set the correct HTTPMethod as well as FHIR headers.
Declaration
Swift
func prepare(request: inout URLRequest) throwsParameters
requestThe request to decorate
-
Instantiate a FHIRServerResponse based on the response and data that we get.
Declaration
Swift
func response(response: URLResponse?, data: Data?, error: Error?) -> FHIRServerResponseParameters
responseThe URLResponse resulting from the request, if any
dataThe data that was returned, if any
errorThe error that was reported, if any
Return Value
An appropriately configured
FHIRServerResponseinstance -
Convenience method to indicate a request that has not actually been sent.
Declaration
Swift
func notSent(_ reason: String) -> FHIRServerResponseParameters
reasonWhy the request was not sent
Return Value
An appropriately configured
FHIRServerResponseinstance
View on GitHub
Install in Dash
FHIRRequestHandler Protocol Reference