Class MockClientHttpResponse

java.lang.Object
org.springframework.mock.http.MockHttpInputMessage
org.springframework.mock.http.client.MockClientHttpResponse
All Implemented Interfaces:
Closeable, AutoCloseable, ClientHttpResponse, HttpInputMessage, HttpMessage

public class MockClientHttpResponse extends MockHttpInputMessage implements ClientHttpResponse
Mock implementation of ClientHttpResponse.
Since:
3.2
Author:
Rossen Stoyanchev, Sam Brannen
  • Constructor Details

    • MockClientHttpResponse

      public MockClientHttpResponse()
      Create a MockClientHttpResponse with an empty response body and HTTP status code OK.
      Since:
      6.0.3
    • MockClientHttpResponse

      public MockClientHttpResponse(byte[] body, HttpStatusCode statusCode)
      Create a MockClientHttpResponse with response body as a byte array and the supplied HTTP status code.
    • MockClientHttpResponse

      public MockClientHttpResponse(byte[] body, int statusCode)
      Create a MockClientHttpResponse with response body as a byte array and a custom HTTP status code.
      Since:
      5.3.17
    • MockClientHttpResponse

      public MockClientHttpResponse(InputStream body, HttpStatusCode statusCode)
      Create a MockClientHttpResponse with response body as InputStream and the supplied HTTP status code.
    • MockClientHttpResponse

      public MockClientHttpResponse(InputStream body, int statusCode)
      Create a MockClientHttpResponse with response body as InputStream and a custom HTTP status code.
      Since:
      5.3.17
  • Method Details