gems webmock 3.34.0

3 hours ago
  • Allow with(query: :any) to match any query string (#1099)

    stub_request(:get, "www.example.com").with(query: :any) matches requests with any query string, or none. RSpec's anything works the same way. Previously, this raised NoMethodError, and you had to write with(query: hash_including({})).

    Use a URL without query parameters when passing query: :any. Otherwise, WebMock raises ArgumentError.

    Thanks to nightpool

  • Raise a clear ArgumentError for an unsupported query option

    Previously, a value such as with(query: :all) raised NoMethodError (undefined method split). The new error lists the supported values.

  • Show anything for keys given without a value to hash_including or hash_excluding outside RSpec

    Previously, with Minitest or Test::Unit, messages showed #<WebMock::Matchers::AnyArgMatcher:0x...>, for example for with(query: hash_including(:a)). RSpec's own matchers already showed anything.

  • Provide HTTP_HOST to to_rack apps when the client has not supplied a Host header (#1084)

    Previously, requests from some HTTP clients reached the Rack app without HTTP_HOST. This caused host checks such as Sinatra's HostAuthorization to see an empty host.

    WebMock now fills in the host from the request URL, including the port when it is not the default. An explicit Host header is preserved.

    Thanks to Benoit Tigeot

  • Fix Rack compatibility for to_rack apps

    The request environment now passes Rack::Lint.

    SERVER_PORT and CONTENT_LENGTH are now strings. If your app or tests read them directly, use string comparisons, such as env['SERVER_PORT'] == "80". The environment also includes SERVER_PROTOCOL.

    CONTENT_TYPE is omitted when the request has no content type. The Content-Length header is passed only as CONTENT_LENGTH, without an extra HTTP_CONTENT_LENGTH entry. Transfer-Encoding is removed because the body has already been decoded.

    Repeated header values are joined into one string. Header values and the body read from rack.input now use binary (ASCII-8BIT) strings.

Don't miss a new webmock release

NewReleases is sending notifications on new releases.