类 MockHttpOutputMessage
- java.lang.Object
- org.springframework.mock.http.MockHttpOutputMessage
- 所有已实现的接口:
HttpMessage
,HttpOutputMessage
- 直接已知子类:
MockClientHttpRequest
public class MockHttpOutputMessage extends Object implements HttpOutputMessage
Mock implementation ofHttpOutputMessage
.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 MockHttpOutputMessage()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 OutputStream
getBody()
Return the body content.byte[]
getBodyAsBytes()
Return body content as a byte array.String
getBodyAsString()
Return the body content interpreted as a UTF-8 string.String
getBodyAsString(Charset charset)
Return the body content as a string.HttpHeaders
getHeaders()
Return the headers.
构造器详细资料
MockHttpOutputMessage
public MockHttpOutputMessage()
方法详细资料
getHeaders
public HttpHeaders getHeaders()
Return the headers.- 指定者:
getHeaders
在接口中HttpMessage
- 返回:
- a corresponding HttpHeaders object (never
null
)
getBody
public OutputStream getBody() throws IOException
Return the body content.- 指定者:
getBody
在接口中HttpOutputMessage
- 返回:
- the output stream body (never
null
) - 抛出:
IOException
- in case of I/O errors
getBodyAsBytes
public byte[] getBodyAsBytes()
Return body content as a byte array.
getBodyAsString
public String getBodyAsString()
Return the body content interpreted as a UTF-8 string.
getBodyAsString
public String getBodyAsString(Charset charset)
Return the body content as a string.- 参数:
charset
- the charset to use to turn the body content to a String