Class: EventMachine::MockHttpRequest::FakeHttpClient
- Inherits:
-
HttpClient
- Object
- Connection
- HttpClient
- EventMachine::MockHttpRequest::FakeHttpClient
- Defined in:
- lib/em-http/mock.rb
Constant Summary
Constants inherited from HttpClient
HttpClient::CONTENT_ENCODING, HttpClient::CONTENT_LENGTH, HttpClient::CONTENT_TYPE, HttpClient::CRLF, HttpClient::ETAG, HttpClient::HOST, HttpClient::KEEP_ALIVE, HttpClient::LAST_MODIFIED, HttpClient::LOCATION, HttpClient::SET_COOKIE, HttpClient::TRANSFER_ENCODING
Constants included from HttpEncoding
HttpEncoding::FIELD_ENCODING, HttpEncoding::HTTP_REQUEST_HEADER
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#response ⇒ Object
writeonly
Sets the attribute response.
Attributes inherited from HttpClient
#content_charset, #error, #last_effective_url, #method, #options, #redirects, #response, #response_header, #uri
Instance Method Summary collapse
Methods inherited from HttpClient
#connect_proxy?, #connection_completed, #disconnect, #dispatch, #finished?, #has_bytes?, #headers, #http_proxy?, #normalize_body, #on_body_data, #on_decoded_body_data, #on_error, #on_request_complete, #parse_chunk_header, #parse_header, #parse_response_header, #parse_socks_response, #post_init, #process_body, #process_chunk_body, #process_chunk_footer, #process_response_footer, #process_websocket, #proxy?, #receive_data, #send, #send_request_body, #send_request_header, #send_socks_connect_request, #send_socks_handshake, #socks_methods, #socks_proxy?, #stream, #websocket?
Methods included from HttpEncoding
#bytesize, #encode_auth, #encode_cookie, #encode_field, #encode_headers, #encode_host, #encode_param, #encode_query, #encode_request, #escape, #form_encode_body, #munge_header_keys, #unescape
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
16 17 18 |
# File 'lib/em-http/mock.rb', line 16 def data @data end |
#response=(value) ⇒ Object (writeonly)
Sets the attribute response
15 16 17 |
# File 'lib/em-http/mock.rb', line 15 def response=(value) @response = value end |
Instance Method Details
#setup(response, uri) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/em-http/mock.rb', line 17 def setup(response, uri) @uri = uri if response == :fail fail(self) else if response.respond_to?(:call) response.call(self) @state = :body else receive_data(response) end @state == :body ? succeed(self) : fail(self) end end |
#unbind ⇒ Object
32 33 |
# File 'lib/em-http/mock.rb', line 32 def unbind end |