Package org.springframework.mock.http

# Class MockHttpOutputMessage

java.lang.Object
org.springframework.mock.http.MockHttpOutputMessage

All Implemented Interfaces:
  `org.springframework.http.HttpMessage`, `org.springframework.http.HttpOutputMessage`

Direct Known Subclasses:
  `MockClientHttpRequest`

public class MockHttpOutputMessage extends Object implements org.springframework.http.HttpOutputMessage
Mock implementation of `HttpOutputMessage`.

Since:
  3.2
Author:
  Rossen Stoyanchev

## Constructor Summary

Constructors
Constructor
Description
`MockHttpOutputMessage()`

## Method Summary

Modifier and Type
Method
Description
`OutputStream`
`getBody()`
`byte[]`
`getBodyAsBytes()`
Return the 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 interpreted as a string using the supplied character set.
`org.springframework.http.HttpHeaders`
`getHeaders()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MockHttpOutputMessage

public MockHttpOutputMessage()

## Method Details

### getHeaders

public org.springframework.http.HttpHeaders getHeaders()

Specified by:
  `getHeaders` in interface `org.springframework.http.HttpMessage`

### getBody

public OutputStream getBody() throws IOException

Specified by:
  `getBody` in interface `org.springframework.http.HttpOutputMessage`
Throws:
  `IOException`

### getBodyAsBytes

public byte[] getBodyAsBytes()
Return the 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 interpreted as a string using the supplied character set.

Parameters:
  `charset` - the charset to use to turn the body content into a String