Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error sending requests after gem update to 1.0.1 #14

Open
aglushkov opened this issue Oct 6, 2021 · 1 comment
Open

Error sending requests after gem update to 1.0.1 #14

aglushkov opened this issue Oct 6, 2021 · 1 comment

Comments

@aglushkov
Copy link

aglushkov commented Oct 6, 2021

General information

  • SDK/Library version: 1.0.1
  • Ruby Version: 3.0.0

Issue description

  FrozenError:
    can't modify frozen String: "application/json"
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:35:in `downcase!'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:35:in `block in format_headers'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:30:in `each'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:30:in `format_headers'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:97:in `_parse_response'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:87:in `block in execute'
# /usr/local/bundle/gems/webmock-3.14.0/lib/webmock/http_lib_adapters/net_http.rb:123:in `start_without_connect'
# /usr/local/bundle/gems/webmock-3.14.0/lib/webmock/http_lib_adapters/net_http.rb:150:in `start'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:86:in `execute'
# /usr/local/bundle/gems/paypal-checkout-sdk-1.0.4/lib/core/paypal_http_client.rb:32:in `_sign_request'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:66:in `block in execute'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:65:in `each'
# /usr/local/bundle/gems/paypalhttp-1.0.1/lib/paypalhttp/http_client.rb:65:in `execute'
@aglushkov
Copy link
Author

It is happens only in tests because I mocked paypal response with frozen headers:

      # frozen_string_literal: true
      # ...
      stub_request(:post, 'https://api.sandbox.paypal.com/v2/checkout/orders')
        .to_return(
          status: 200,
          body: { id: 'PAY-1B56960729604235TKQQIYVY' }.to_json,
          headers: { 'Content-Type' => 'application/json' }
        )

It looks currently like issue of webmock gem, but changing code here from downcase! to downcase is not a big deal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant