Cassette

public struct Cassette

HTTP interactions are recorded into a Cassette to be replayed later by a VCR instance. A Cassette can be used to store many different HTTP interactions.

  • Attempt to find and load a test fixture with the specified name having a .json extension.

    For example, loading a JSON fixture, ignoring any errors, that has the name cassette.json:

    let vhs = try! Cassette(fixtureWithName: "cassette")
    

    The vhs value can then be fed into a VCR instance to replay the stored HTTP interactions.

    Throws

    If the requested fixture cannot be found it throws VCR.Error.missing

    Declaration

    Swift

    public init(fixtureWithName name: String) throws

    Parameters

    fixtureWithName

    The name of the fixture to find. Without the .json file-extension.