Class Route.FulfillOptions

java.lang.Object
com.microsoft.playwright.Route.FulfillOptions
Enclosing interface:
Route

public static class Route.FulfillOptions extends Object
  • Field Details

    • body

      public String body
      Optional response body as text.
    • bodyBytes

      public byte[] bodyBytes
      Optional response body as raw bytes.
    • contentType

      public String contentType
      If set, equals to setting Content-Type response header.
    • headers

      public Map<String,String> headers
      Response headers. Header values will be converted to a string.
    • path

      public Path path
      File path to respond with. The content type will be inferred from file extension. If path is a relative path, then it is resolved relative to the current working directory.
    • response

      public APIResponse response
      APIResponse to fulfill route's request with. Individual fields of the response (such as headers) can be overridden using fulfill options.
    • status

      public Integer status
      Response status code, defaults to 200.
  • Constructor Details

    • FulfillOptions

      public FulfillOptions()
  • Method Details

    • setBody

      public Route.FulfillOptions setBody(String body)
      Optional response body as text.
    • setBodyBytes

      public Route.FulfillOptions setBodyBytes(byte[] bodyBytes)
      Optional response body as raw bytes.
    • setContentType

      public Route.FulfillOptions setContentType(String contentType)
      If set, equals to setting Content-Type response header.
    • setHeaders

      public Route.FulfillOptions setHeaders(Map<String,String> headers)
      Response headers. Header values will be converted to a string.
    • setPath

      public Route.FulfillOptions setPath(Path path)
      File path to respond with. The content type will be inferred from file extension. If path is a relative path, then it is resolved relative to the current working directory.
    • setResponse

      public Route.FulfillOptions setResponse(APIResponse response)
      APIResponse to fulfill route's request with. Individual fields of the response (such as headers) can be overridden using fulfill options.
    • setStatus

      public Route.FulfillOptions setStatus(int status)
      Response status code, defaults to 200.