Class MockLowLevelHttpRequest

    • Field Detail

      • url

        private java.lang.String url
        Request URL or null for none.
      • headersMap

        private final java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headersMap
        Map of lowercase header name to values.
    • Constructor Detail

      • MockLowLevelHttpRequest

        public MockLowLevelHttpRequest()
      • MockLowLevelHttpRequest

        public MockLowLevelHttpRequest​(java.lang.String url)
        Parameters:
        url - Request URL or null for none
        Since:
        1.4
    • Method Detail

      • getUrl

        public java.lang.String getUrl()
        Returns the request URL or null for none.
        Since:
        1.5
      • getHeaders

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
        Returns an unmodifiable view of the map of lowercase header name to values.

        Note that unlike this method, getFirstHeaderValue(String) and getHeaderValues(String) are not case sensitive with respect to the input header name.

        Since:
        1.5
      • getFirstHeaderValue

        public java.lang.String getFirstHeaderValue​(java.lang.String name)
        Returns the value of the first header of the given name or null for none.
        Parameters:
        name - header name (may be any case)
        Since:
        1.13
      • getHeaderValues

        public java.util.List<java.lang.String> getHeaderValues​(java.lang.String name)
        Returns the unmodifiable list of values of the headers of the given name (may be empty).
        Parameters:
        name - header name (may be any case)
        Since:
        1.13
      • setUrl

        public MockLowLevelHttpRequest setUrl​(java.lang.String url)
        Sets the request URL or null for none.
        Since:
        1.5
      • getContentAsString

        public java.lang.String getContentAsString()
                                            throws java.io.IOException
        Returns HTTP content as a string, taking care of any encodings of the content if necessary.

        Returns an empty string if there is no HTTP content.

        Throws:
        java.io.IOException
        Since:
        1.12