mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-12-10 00:03:09 -05:00
Merge pull request #321 from stripe/revert-299-brandur-uri-escape
Revert removal of `URI.escape`
This commit is contained in:
commit
2f09c74c01
@ -1,5 +1,3 @@
|
|||||||
require "webrick"
|
|
||||||
|
|
||||||
module Stripe
|
module Stripe
|
||||||
module Util
|
module Util
|
||||||
def self.objects_to_ids(h)
|
def self.objects_to_ids(h)
|
||||||
@ -95,10 +93,7 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.url_encode(key)
|
def self.url_encode(key)
|
||||||
# Unfortunately, URI.escape was deprecated. Here we use a method from
|
URI.escape(key.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
||||||
# WEBrick instead given that it's a fairly close approximation (credit to
|
|
||||||
# the AWS Ruby SDK for coming up with the technique).
|
|
||||||
WEBrick::HTTPUtils.escape(key.to_s).gsub('%5B', '[').gsub('%5D', ']')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.flatten_params(params, parent_key=nil)
|
def self.flatten_params(params, parent_key=nil)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user