Class: Cloudflare::RawResponse
- Inherits:
-
Object
- Object
- Cloudflare::RawResponse
- Defined in:
- lib/cloudflare_workers.rb
Overview
RawResponse wraps an already-constructed JS ‘Response` so routes can return it through Sinatra and have `build_js_response` pass it through to the Workers runtime untouched. Needed when the Response carries runtime-only properties that would disappear if reconstructed — e.g. a 101 upgrade Response with `.webSocket`. Unlike `BinaryBody`, no new Response is constructed; the stored JS object is returned as-is.
Instance Attribute Summary collapse
-
#js_response ⇒ Object
readonly
Returns the value of attribute js_response.
Instance Method Summary collapse
- #close ⇒ Object
-
#each ⇒ Object
Rack body contract — yield nothing.
-
#initialize(js_response) ⇒ RawResponse
constructor
A new instance of RawResponse.
- #raw_response? ⇒ Boolean
Constructor Details
#initialize(js_response) ⇒ RawResponse
Returns a new instance of RawResponse.
498 499 500 |
# File 'lib/cloudflare_workers.rb', line 498 def initialize(js_response) @js_response = js_response end |
Instance Attribute Details
#js_response ⇒ Object (readonly)
Returns the value of attribute js_response.
496 497 498 |
# File 'lib/cloudflare_workers.rb', line 496 def js_response @js_response end |
Instance Method Details
#close ⇒ Object
506 |
# File 'lib/cloudflare_workers.rb', line 506 def close; end |
#each ⇒ Object
Rack body contract — yield nothing. The bytes never flow through Ruby; the JS Response goes straight to the runtime.
504 |
# File 'lib/cloudflare_workers.rb', line 504 def each; end |
#raw_response? ⇒ Boolean
508 509 510 |
# File 'lib/cloudflare_workers.rb', line 508 def raw_response? true end |