Package org.springframework.mock.http
Class MockHttpOutputMessage
java.lang.Object
org.springframework.mock.http.MockHttpOutputMessage
- All Implemented Interfaces:
HttpMessage,HttpOutputMessage
- Direct Known Subclasses:
MockClientHttpRequest
Mock implementation of
HttpOutputMessage.- Since:
- 3.2
- Author:
- Rossen Stoyanchev
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBody()Return the body content.byte[]Return body content as a byte array.Return the body content interpreted as a UTF-8 string.getBodyAsString(Charset charset) Return the body content as a string.Return the headers.
-
Constructor Details
-
MockHttpOutputMessage
public MockHttpOutputMessage()
-
-
Method Details
-
getHeaders
Return the headers.- Specified by:
getHeadersin interfaceHttpMessage- Returns:
- a corresponding HttpHeaders object (never
null)
-
getBody
Return the body content.- Specified by:
getBodyin interfaceHttpOutputMessage- Returns:
- the output stream body (never
null) - Throws:
IOException- in case of I/O errors
-
getBodyAsBytes
public byte[] getBodyAsBytes()Return body content as a byte array. -
getBodyAsString
Return the body content interpreted as a UTF-8 string. -
getBodyAsString
Return the body content as a string.- Parameters:
charset- the charset to use to turn the body content to a String
-