You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
note how the value is being used as the key and value.
The following test added to price_spec.cr illustrates the problem:
it "listing prices with params"doWebMock.stub(:get, "https://api.stripe.com/v1/prices")
.with(body:"currency=AUD")
.to_return(status:200, body:File.read("spec/support/list_prices.json"), headers: {"Content-Type" => "application/json"})
prices =Stripe::Price.list(currency:"AUD")
prices.first.id.should eq("price_1IqjDxJN5FrkuvKhKExUK1B2")
end
With resulting error:
Real HTTP connections are disabled. Unregistered request: GET https://api.stripe.com/v1/prices with body "AUD=AUD" with headers {"Content-Length" => "7", "Content-Type" => "application/x-www-form-urlencoded", "Host" => "api.stripe.com", "Authorization" => "Bearer test"}
Note that the body has the value twice.
The solution appears to be a call to stringify in the add_list_method macro, which makes the above test pass:
{%for x in arguments.map &.var.id %}
builder.add({{x.stringify}}, {{x.id}}) unless {{x.id}}.nil?
{%end%}
The text was updated successfully, but these errors were encountered:
I think #40 broke list methods. The code generated prior to this change looked like this (for
Price
in this case):after the changes in #40 the generated code looks like this:
Note that the keys are no longer quoted. This results in parameters like this being generated:
which URL decoded is:
note how the value is being used as the key and value.
The following test added to
price_spec.cr
illustrates the problem:With resulting error:
Note that the body has the value twice.
The solution appears to be a call to
stringify
in theadd_list_method
macro, which makes the above test pass:The text was updated successfully, but these errors were encountered: