File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ def get_param params, key
77
77
78
78
def self . full_url client , path
79
79
path = path [ :_links ] [ :self ] [ :href ] if path . is_a? Hash
80
- path . sub! /^https?:\/ \/ [^\/ ]*/ , ""
80
+ path = path . sub /^https?:\/ \/ [^\/ ]*/ , ""
81
81
if path . start_with? client . api_url
82
82
path
83
83
elsif path . start_with? "/"
Original file line number Diff line number Diff line change @@ -271,6 +271,22 @@ def unknown_param; "?"; end
271
271
end
272
272
end
273
273
274
+ it "#post (do not mutate path)" do
275
+ token = DwollaV2 ::Token . new client , hash_params
276
+ path = "/foo"
277
+ res_body = { :hello => "world" , :timestamp => Time . now . utc . round ( 3 ) }
278
+ stub_request ( :post , "#{ token . client . api_url } #{ path } " )
279
+ . with ( :headers => { "Accept" => "application/vnd.dwolla.v1.hal+json" } )
280
+ . to_return ( :status => 200 ,
281
+ :headers => { "Content-Type" => "application/json" } ,
282
+ :body => generate_json ( res_body ) )
283
+ path_variants ( path ) . each do |path_variant |
284
+ path_variant_copy = path_variant . clone
285
+ expect ( token . post path_variant ) . to eq res_body
286
+ expect ( path_variant ) . to eq path_variant_copy
287
+ end
288
+ end
289
+
274
290
it "#post (error)" do
275
291
token = DwollaV2 ::Token . new client , hash_params
276
292
path = "/foo"
You can’t perform that action at this time.
0 commit comments