Package com.microsoft.playwright
Class Route.FulfillOptions
- java.lang.Object
-
- com.microsoft.playwright.Route.FulfillOptions
-
-
Field Summary
Fields Modifier and Type Field Description StringbodyOptional response body as text.byte[]bodyBytesOptional response body as raw bytes.StringcontentTypeIf set, equals to settingContent-Typeresponse header.Map<String,String>headersResponse headers.PathpathFile path to respond with.APIResponseresponseAPIResponseto fulfill route's request with.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(String body)Optional response body as text.Route.FulfillOptionssetBodyBytes(byte[] bodyBytes)Optional response body as raw bytes.Route.FulfillOptionssetContentType(String contentType)If set, equals to settingContent-Typeresponse header.Route.FulfillOptionssetHeaders(Map<String,String> headers)Response headers.Route.FulfillOptionssetPath(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 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 settingContent-Typeresponse 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. 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 Integer status
Response status code, defaults to200.
-
-
Method Detail
-
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 settingContent-Typeresponse 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. 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.
-
-