class Playwright::Route::FulfillResponse
- Playwright::Route::FulfillResponse
- Reference
- Object
Included Modules
- JSON::Serializable
Defined in:
playwright/route.crConstructors
- .new(pull : JSON::PullParser)
- .new(status : Int32 | Nil = nil, headers : Nil | Hash(String, String) = nil, content_type : Nil | String = nil, body : String = nil, path : Path | Nil = nil)
Instance Method Summary
- #body : String
- #body=(body : String)
- #body_bytes : Bytes
- #body_bytes=(body_bytes : Bytes)
-
#content_type : String | Nil
If set, equals to setting
Content-Type
response header. -
#content_type=(content_type : String | Nil)
If set, equals to setting
Content-Type
response header. -
#headers : Hash(String, String) | Nil
Optional response headers.
-
#headers=(headers : Hash(String, String) | Nil)
Optional response headers.
-
#path : Path | Nil
Optional file path to respond with.
-
#path=(path : Path | Nil)
Optional file path to respond with.
-
#status : Int32 | Nil
Response status code, defaults to
200
. -
#status=(status : Int32 | Nil)
Response status code, defaults to
200
.
Constructor Detail
def self.new(status : Int32 | Nil = nil, headers : Nil | Hash(String, String) = nil, content_type : Nil | String = nil, body : String = nil, path : Path | Nil = nil)
#
Instance Method Detail
def content_type=(content_type : String | Nil)
#
If set, equals to setting Content-Type
response header.
def headers : Hash(String, String) | Nil
#
Optional response headers. Header values will be converted to a string.
def headers=(headers : Hash(String, String) | Nil)
#
Optional response headers. Header values will be converted to a string.
def path : Path | Nil
#
Optional 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.