File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,13 @@ def write_connection_header(version)
104
104
def write_upgrade_header ( upgrade )
105
105
@stream . write ( "connection: upgrade\r \n upgrade: #{ upgrade } \r \n " )
106
106
end
107
+
108
+ # Indicates whether the connection has been hijacked meaning its
109
+ # IO has been handed over and is not usable anymore.
110
+ # @return [Boolean] hijack status
111
+ def hijacked?
112
+ @stream . nil?
113
+ end
107
114
108
115
# Effectively close the connection and return the underlying IO.
109
116
# @return [IO] the underlying non-blocking IO.
Original file line number Diff line number Diff line change 19
19
server_wrapper = server . hijack!
20
20
expect ( server . persistent ) . to be == false
21
21
end
22
+
23
+ it "should repord itself as #hijacked? after the hijack" do
24
+ expect ( server . hijacked? ) . to be == false
25
+ server . hijack!
26
+ expect ( server . hijacked? ) . to be == true
27
+ end
22
28
23
29
it "should use non-chunked output" do
24
30
expect ( body ) . to receive ( :ready? ) . and_return ( false )
25
31
expect ( body ) . to receive ( :empty? ) . and_return ( false )
26
- expect ( body ) . to receive ( :length ) . and_return ( nil )
32
+ expect ( body ) . to receive ( :length ) . twice . and_return ( nil )
27
33
expect ( body ) . to receive ( :each ) . and_return ( nil )
28
34
29
35
expect ( server ) . to receive ( :write_body_and_close )
You can’t perform that action at this time.
0 commit comments