Class: MockServer::HttpError
- Inherits:
-
Object
- Object
- MockServer::HttpError
- Defined in:
- lib/mockserver/models.rb
Instance Attribute Summary collapse
-
#delay ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection.
-
#drop_connection ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection.
-
#primary ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection.
-
#response_bytes ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection.
-
#stream_error ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(drop_connection: nil, response_bytes: nil, stream_error: nil, delay: nil, primary: nil) ⇒ HttpError
constructor
A new instance of HttpError.
- #to_h ⇒ Object
Constructor Details
#initialize(drop_connection: nil, response_bytes: nil, stream_error: nil, delay: nil, primary: nil) ⇒ HttpError
Returns a new instance of HttpError.
1001 1002 1003 1004 1005 1006 1007 |
# File 'lib/mockserver/models.rb', line 1001 def initialize(drop_connection: nil, response_bytes: nil, stream_error: nil, delay: nil, primary: nil) @drop_connection = drop_connection @response_bytes = response_bytes @stream_error = stream_error @delay = delay @primary = primary end |
Instance Attribute Details
#delay ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection. Takes precedence over drop_connection when both are set.
999 1000 1001 |
# File 'lib/mockserver/models.rb', line 999 def delay @delay end |
#drop_connection ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection. Takes precedence over drop_connection when both are set.
999 1000 1001 |
# File 'lib/mockserver/models.rb', line 999 def drop_connection @drop_connection end |
#primary ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection. Takes precedence over drop_connection when both are set.
999 1000 1001 |
# File 'lib/mockserver/models.rb', line 999 def primary @primary end |
#response_bytes ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection. Takes precedence over drop_connection when both are set.
999 1000 1001 |
# File 'lib/mockserver/models.rb', line 999 def response_bytes @response_bytes end |
#stream_error ⇒ Object
stream_error: reset the matched request stream with this error code (HTTP/2 RST_STREAM / HTTP/3 RESET_STREAM) instead of returning a response; HTTP/1.1 has no stream concept so this falls back to dropping the connection. Takes precedence over drop_connection when both are set.
999 1000 1001 |
# File 'lib/mockserver/models.rb', line 999 def stream_error @stream_error end |
Class Method Details
.error ⇒ Object
1031 1032 1033 |
# File 'lib/mockserver/models.rb', line 1031 def self.error new end |
.from_hash(data) ⇒ Object
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 |
# File 'lib/mockserver/models.rb', line 1019 def self.from_hash(data) return nil if data.nil? new( drop_connection: data['dropConnection'], response_bytes: data['responseBytes'], stream_error: data['streamError'], delay: Delay.from_hash(data['delay']), primary: data['primary'] ) end |
Instance Method Details
#to_h ⇒ Object
1009 1010 1011 1012 1013 1014 1015 1016 1017 |
# File 'lib/mockserver/models.rb', line 1009 def to_h MockServer.strip_none({ 'dropConnection' => @drop_connection, 'responseBytes' => @response_bytes, 'streamError' => @stream_error, 'delay' => @delay&.to_h, 'primary' => @primary }) end |