Class OperationResponseFactory

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

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

    • OperationResponseFactory

      public OperationResponseFactory()
  • Method Details

    • create

      public OperationResponse create(int status, org.springframework.http.HttpHeaders headers, byte[] content)
      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 response's headers
      content - the content of the response
      Returns:
      the OperationResponse
    • 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