Package com.microsoft.playwright
Class Route.FulfillOptions
- java.lang.Object
-
- com.microsoft.playwright.Route.FulfillOptions
-
- Enclosing interface:
- Route
public static class Route.FulfillOptions extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringbodyOptional response body as text.byte[]bodyBytesOptional response body as raw bytes.java.lang.StringcontentTypeIf set, equals to settingContent-Typeresponse header.java.util.Map<java.lang.String,java.lang.String>headersResponse headers.java.nio.file.PathpathFile path to respond with.APIResponseresponseAPIResponseto fulfill route's request with.java.lang.IntegerstatusResponse status code, defaults to200.
-
Constructor Summary
Constructors Constructor Description FulfillOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Route.FulfillOptionssetBody(java.lang.String body)Optional response body as text.Route.FulfillOptionssetBodyBytes(byte[] bodyBytes)Optional response body as raw bytes.Route.FulfillOptionssetContentType(java.lang.String contentType)If set, equals to settingContent-Typeresponse header.Route.FulfillOptionssetHeaders(java.util.Map<java.lang.String,java.lang.String> headers)Response headers.Route.FulfillOptionssetPath(java.nio.file.Path path)File path to respond with.Route.FulfillOptionssetResponse(APIResponse response)APIResponseto fulfill route's request with.Route.FulfillOptionssetStatus(int status)Response status code, defaults to200.
-
-
-
Field Detail
-
body
public java.lang.String body
Optional response body as text.
-
bodyBytes
public byte[] bodyBytes
Optional response body as raw bytes.
-
contentType
public java.lang.String contentType
If set, equals to settingContent-Typeresponse header.
-
headers
public java.util.Map<java.lang.String,java.lang.String> headers
Response headers. Header values will be converted to a string.
-
path
public java.nio.file.Path path
File path to respond with. The content type will be inferred from file extension. Ifpathis a relative path, then it is resolved relative to the current working directory.
-
response
public APIResponse response
APIResponseto fulfill route's request with. Individual fields of the response (such as headers) can be overridden using fulfill options.
-
status
public java.lang.Integer status
Response status code, defaults to200.
-
-
Method Detail
-
setBody
public Route.FulfillOptions setBody(java.lang.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(java.lang.String contentType)
If set, equals to settingContent-Typeresponse header.
-
setHeaders
public Route.FulfillOptions setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Response headers. Header values will be converted to a string.
-
setPath
public Route.FulfillOptions setPath(java.nio.file.Path path)
File path to respond with. The content type will be inferred from file extension. Ifpathis a relative path, then it is resolved relative to the current working directory.
-
setResponse
public Route.FulfillOptions setResponse(APIResponse response)
APIResponseto 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 to200.
-
-