Class OperationResponseFactory

java.lang.Object
org.springframework.restdocs.operation.OperationResponseFactory

public class OperationResponseFactory extends Object
A factory for creating OperationResponses.
Author:
Andy Wilkinson, Clyde Stubbs
  • Constructor Details

    • OperationResponseFactory

      public OperationResponseFactory()
  • Method Details

    • create

      public OperationResponse create(org.springframework.http.HttpStatusCode status, org.springframework.http.HttpHeaders headers, byte[] content)
      Creates a new OperationResponse without cookies. If the response has any content, the given headers will be augmented to ensure that they include a Content-Length header.
      Parameters:
      status - the status of the response
      headers - the request's headers
      content - the content of the request
      Returns:
      the OperationResponse
      Since:
      3.0.0
    • create

      public OperationResponse create(org.springframework.http.HttpStatusCode status, org.springframework.http.HttpHeaders headers, byte[] content, Collection<ResponseCookie> cookies)
      Creates a new OperationResponse. If the response has any content, the given headers will be augmented to ensure that they include a Content-Length header.
      Parameters:
      status - the status of the response
      headers - the request's headers
      content - the content of the request
      cookies - the cookies
      Returns:
      the OperationResponse
      Since:
      3.0.0
    • createFrom

      public OperationResponse createFrom(OperationResponse original, byte[] newContent)
      Creates a new OperationResponse based on the given original but with the given newContent. If the original response had a Content-Length header it will be modified to match the length of the new content.
      Parameters:
      original - the original response
      newContent - the new content
      Returns:
      the new response with the new content
    • createFrom

      public OperationResponse createFrom(OperationResponse original, org.springframework.http.HttpHeaders newHeaders)
      Creates a new OperationResponse based on the given original but with the given newHeaders.
      Parameters:
      original - the original response
      newHeaders - the new headers
      Returns:
      the new response with the new headers