Skip to content

v1.11.0

Latest

Choose a tag to compare

@MarioRuiz MarioRuiz released this 23 Sep 16:02

Compatibility

Upgrade from 1.10.x. Literal JSON strings are sent unchanged.

  • Requires nice_hash 1.21 and string_pattern 2.5 (nice_hash ~> 1.21). Ruby 3.0 or newer.
  • generate(seed:) and generate_n(seed:) no longer repeat the strings from nice_hash 1.19. :uuid, :iban and :luhn are not repeatable from seed:.
  • StringPattern.block_list matches literals. Set StringPattern.block_list_regexp = true when the list holds regular expressions.
  • A Regexp pattern must match the whole string.
  • A one-element pattern array such as [:"3:L"] generates 1 to 5 strings, including in connection headers (still generated once, when the client is created).
  • Pattern symbols and shorthands in a request body or request header (:"10-20:L", :"a|b", :uuid, :email, :iban, :luhn, [:iban, "DE"], [:luhn, 15], Range, Regexp, DateTime, Boolean) are expanded before the request is sent. Previously :uuid was sent as the text "uuid". Strings such as "10:N" or "a|b" are still sent as written.
  • validate_response treats string keys the same as symbol keys, so a match that used to fail on key type can now be ok: true. An expected pattern can also be ok: true when the response value fits it.

Added

  • Request data and per-request headers expand nice_hash pattern symbols and shorthands on each request.
  • NiceHttp.validate_response accepts string or symbol keys and checks pattern fields with NiceHash.validate. explain: true adds :explain (valid, errors, message, index) when a pattern fails.

Fixed

  • Logging a response with no content-type no longer raises, so cookie handling after the log still runs.
  • Reconnecting after a dropped connection on POST, PUT, PATCH, DELETE and HEAD keeps the response body.