Class RequestMatcher


  • @ProviderType
    public final class RequestMatcher
    extends Object
    Defines which requests should match. Only one service and one url matcher can be defined.
    • Constructor Detail

      • RequestMatcher

        public RequestMatcher()
    • Method Detail

      • serviceId

        public RequestMatcher serviceId​(String value)
        Parameters:
        value - Service ID
        Returns:
        this
      • urlStartsWith

        public RequestMatcher urlStartsWith​(String value)
        Parameters:
        value - Starting part of URL
        Returns:
        this
      • urlMatches

        public RequestMatcher urlMatches​(org.hamcrest.Matcher<String> value)
        Parameters:
        value - Matcher for URL
        Returns:
        this
      • urlMatches

        public RequestMatcher urlMatches​(Pattern pattern)
        Parameters:
        pattern - Regex pattern to mathc URL
        Returns:
        this
      • response

        public void response​(String payload)
        Set the response that this request matcher should return.
        Parameters:
        payload - Payload
      • response

        public void response​(io.wcm.caravan.io.http.response.CaravanHttpResponse payload)
        Set the response that this request matcher should return.
        Parameters:
        payload - Payload