Skip to content

Invalid path value for HTTP header matcher. #34

@skaggmannen

Description

@skaggmannen

Hi,

Apparently pact-ruby-standalone does not use the standard header path format of $.header.<header name> when parsing pact files. Instead the non-standard format $.headers.<header name> is used (notice the extra s). This leads to incompatibility with pact-jvm (as mentioned in e.g. pact-foundation/pact-net#184 (comment)) which generates the paths according to the pact specification.

Here's the relevant part of the pact specification:

Matcher Path expressions

Pact does not support the full JSON path expressions, only ones that match the following rules:

  1. All paths start with a dollar ($), representing the root.
  2. All path elements are either separated by periods (.) or use the JSON path bracket notation (square brackets and single quotes around the values: e.g. ['x.y']), except array indices which use square brackets ([]). For elements where the value contains white space or non-alphanumeric characters, the JSON path bracket notation (['']) should be used.
  3. The second element of the path is the http type that the matcher is applied to (e.g., $.body or $.header).
  4. Path elements represent keys.
  5. A star (*) can be used to match all keys of a map or all items of an array (one level only).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions