Class OperationRequestFactory

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

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

    • OperationRequestFactory

      public OperationRequestFactory()
  • Method Details

    • create

      public OperationRequest create(URI uri, org.springframework.http.HttpMethod method, byte[] content, org.springframework.http.HttpHeaders headers, Collection<OperationRequestPart> parts, Collection<RequestCookie> cookies)
      Creates a new OperationRequest. The given headers will be augmented to ensure that they always include a Content-Length header if the request has any content and a Host header.
      Parameters:
      uri - the request's uri
      method - the request method
      content - the content of the request
      headers - the request's headers
      parts - the request's parts
      cookies - the request's cookies
      Returns:
      the OperationRequest
      Since:
      3.0.0
    • create

      public OperationRequest create(URI uri, org.springframework.http.HttpMethod method, byte[] content, org.springframework.http.HttpHeaders headers, Collection<OperationRequestPart> parts)
      Creates a new OperationRequest. The given headers will be augmented to ensure that they always include a Content-Length header if the request has any content and a Host header.
      Parameters:
      uri - the request's uri
      method - the request method
      content - the content of the request
      headers - the request's headers
      parts - the request's parts
      Returns:
      the OperationRequest
      Since:
      3.0.0
    • createFrom

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

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