org.springframework.mock.http

Class MockHttpOutputMessage

  • java.lang.Object
    • org.springframework.mock.http.MockHttpOutputMessage
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.io.OutputStream getBody()
      Return the body content.
      byte[] getBodyAsBytes()
      Return body content as a byte array.
      java.lang.String getBodyAsString()
      Return the body content interpreted as a UTF-8 string.
      java.lang.String getBodyAsString(java.nio.charset.Charset charset)
      Return the body content as a string.
      HttpHeaders getHeaders()
      Return the headers.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MockHttpOutputMessage

        public MockHttpOutputMessage()
    • Method Detail

      • getHeaders

        public HttpHeaders getHeaders()
        Return the headers.
        Specified by:
        getHeaders in interface HttpMessage
        Returns:
        a corresponding HttpHeaders object (never null)
      • getBody

        public java.io.OutputStream getBody()
                                     throws java.io.IOException
        Return the body content.
        Specified by:
        getBody in interface HttpOutputMessage
        Returns:
        the output stream body (never null)
        Throws:
        java.io.IOException - in case of I/O errors
      • getBodyAsBytes

        public byte[] getBodyAsBytes()
        Return body content as a byte array.
      • getBodyAsString

        public java.lang.String getBodyAsString()
        Return the body content interpreted as a UTF-8 string.
      • getBodyAsString

        public java.lang.String getBodyAsString(java.nio.charset.Charset charset)
        Return the body content as a string.
        Parameters:
        charset - the charset to use to turn the body content to a String