-
Return
effective_urlas a String for stubbed Typhoeus responses (#869)Previously, this was an
Addressable::URI. If your code calls methods such aseffective_url.host, parse the returned string into a URI first.The URL keeps the request's port, query order and encoding. It follows curl's formatting: for example,
http://example.com:80becomeshttp://example.com:80/. Stubbed timeouts now provide aneffective_urltoo.Thanks to Tom Brammar
-
Fix incorrect removal of default ports from displayed URLs
WebMock could accidentally remove
:80or:443from a URL's path or query. For example, an error message could show/foo/barinstead of/foo:80/bar.Only the host's default port is now removed. This also works when the port is immediately followed by a query string, as in
http://example.com:80?a=b. -
Set
return_codeto:okfor completed stubbed Typhoeus requests (#736)return_codeis now:okandreturn_messageis now"No error"; both were previouslynil. This includes HTTP error responses such as 404::okmeans the transfer completed. Stubbed timeouts still return:operation_timedout.Thanks to Michael Spiz
-
Fix the raw headers returned by stubbed Typhoeus responses
The
response_headersstring now uses the stubbed HTTP status. For example, a 404 stub no longer reportsHTTP/1.1 200 OK.Stubs without headers now return an empty
headershash ({}) instead ofnil. Theirresponse_headerscontains the status line instead of beingnil.The raw headers use binary string encoding, matching real responses. For timeouts,
response_headersis now an empty string.