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.
1223 1224 1225 1226 1227 1228 1229 |
# File 'lib/mockserver/models.rb', line 1223 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.
1221 1222 1223 |
# File 'lib/mockserver/models.rb', line 1221 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.
1221 1222 1223 |
# File 'lib/mockserver/models.rb', line 1221 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.
1221 1222 1223 |
# File 'lib/mockserver/models.rb', line 1221 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.
1221 1222 1223 |
# File 'lib/mockserver/models.rb', line 1221 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.
1221 1222 1223 |
# File 'lib/mockserver/models.rb', line 1221 def stream_error @stream_error end |
Class Method Details
.error ⇒ Object
1253 1254 1255 |
# File 'lib/mockserver/models.rb', line 1253 def self.error new end |
.from_hash(data) ⇒ Object
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 |
# File 'lib/mockserver/models.rb', line 1241 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
1231 1232 1233 1234 1235 1236 1237 1238 1239 |
# File 'lib/mockserver/models.rb', line 1231 def to_h MockServer.strip_none({ 'dropConnection' => @drop_connection, 'responseBytes' => @response_bytes, 'streamError' => @stream_error, 'delay' => @delay&.to_h, 'primary' => @primary }) end |