MatchType

public enum MatchType

A type the defines a property by which a Track and URLRequest are compared to see if they are a match.

In order to properly replay previously recorded requests, VHS can match HTTP requests to a previously recorded one.

  • The HTTP method (i.e. GET, POST, PUT or DELETE) of the request.

    Declaration

    Swift

    case method
  • url

    The full URI of the request.

    Declaration

    Swift

    case url
  • The path of the URI.

    Declaration

    Swift

    case path
  • The query string values of the URI. The query string ordering does not affect matching results (it’s order-agnostic).

    Declaration

    Swift

    case query
  • The request headers.

    Declaration

    Swift

    case headers
  • The body of the request.

    Declaration

    Swift

    case body
  • A custom closure or function that can be defined outside of VHS.

    Parameter

    Parameter using: A closure that accepts two arguments, a Track instance and URLRequest instance. If the closure returns true it is assumed that the Track matches for a given URLRequest. If the closure returns false it is assumed that the Track does not match for a given URLRequest.

    Declaration

    Swift

    case custom(using: (Track, URLRequest) -> Bool)

    Parameters

    using

    A closure that accepts two arguments, a Track instance and URLRequest instance. If the closure returns true it is assumed that the Track matches for a given URLRequest. If the closure returns false it is assumed that the Track does match for a given URLRequest.