mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
added support for raising connection refused error responses
This commit is contained in:
parent
67eb755a3b
commit
e16ea30b14
@ -213,6 +213,17 @@ module HTTPX
|
||||
@read_buffer.clear
|
||||
end
|
||||
@state = nextstate
|
||||
rescue Errno::ECONNREFUSED => e
|
||||
emit_error(e)
|
||||
@state = :closed
|
||||
emit(:close)
|
||||
end
|
||||
|
||||
def emit_error(e)
|
||||
response = ErrorResponse.new(e, 0, @options)
|
||||
@pending.each do |request, _|
|
||||
emit(:response, request, response)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user