lib/httpx/request.rb in httpx-1.1.4 vs lib/httpx/request.rb in httpx-1.1.5
- old
+ new
@@ -117,13 +117,24 @@
# sets the +response+ on this request.
def response=(response)
return unless response
- if response.is_a?(Response) && response.status == 100 && @headers.key?("expect")
- @informational_status = response.status
- return
+ if response.is_a?(Response) && response.status < 200
+ # deal with informational responses
+
+ if response.status == 100 && @headers.key?("expect")
+ @informational_status = response.status
+ return
+ end
+
+ if response.status >= 103
+ # 103 Early Hints advertises resources in document to browsers.
+ # not very relevant for an HTTP client, discard.
+ return
+ end
end
+
@response = response
emit(:response_started, response)
end