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

    name

    The name of the Mapping. This is used to uniquely identify this mapping.

    sourceLocation

    This defines all urls this Mapping should apply to.

    destinationLocation

    This defines the changes for the url.