Fix spec_request on ruby-trunk (2.2.0dev)

Manually percent-encode square brackets in query string. This fixes
current travis build issues.

2.2.0dev has recently changed URI parsing from RFC2396 to RFC3986.
Square brackets in RFC3986 are required to be percent-encoded when
present in the query string of a URI. URI.encode on 2.2.0dev isn't
currently updated to support this encoding (see:
    https://bugs.ruby-lang.org/issues/9990)