dukeofharen / httplaceholder

A very flexible cross platform HTTP stub application.
MIT License
109 stars 4 forks source link

Updated display URL parser to also support regular expressions #297

Closed dukeofharen closed 1 year ago

dukeofharen commented 1 year ago

Pull request type

Please check the type of change your PR introduces:

What is the new behavior?

An option was added to user the display URL variable parser with a regular expression, to parse only a part of the URL as part of your response.

# The display URL of the current request is parsed with a regular expression and the result of the regex is written to the response.
- id: dynamic-display-url-regex-example
  conditions:
    method: GET
    url:
      path:
        regex: /dynamic-display-url-regex/users/(.*)/orders
  response:
    enableDynamicMode: true
    text: "User ID: ((display_url:'\/users\/([0-9]{3})\/orders'))"
    headers:
      X-Header: "((display_url:'\/users\/([0-9]{3})\/orders'))"
  priority: 0

Does this introduce a breaking change?