Mapping
public struct Mapping
A Mapping is a declaration of a single mapping. All urls that
match the description of the sourceLocation will be changed
according to the description in the destinationLocation.
All nil values are ignored in this case.
Examples
This Mapping will update all http requests to https requests.
Mapping(name: "https-ify", sourceLocation: MappingLocation(scheme: "http"), destinationLocation: MappingLocation(scheme: "https"))
This mapping will redirect all requests to localhost.
Mapping(name: "map local", sourceLocation: MappingLocation(), destinationLocation: MappingLocation(host: "localhost")
-
Initializes a new
Mapping.Declaration
Swift
public init(name: String, sourceLocation: MappingLocation, destinationLocation: MappingLocation)Parameters
nameThe name of the
Mapping. This is used to uniquely identify this mapping.sourceLocationThis defines all urls this
Mappingshould apply to.destinationLocationThis defines the changes for the url.
View on GitHub
Mapping Structure Reference