Skip to content

Commit 91e4d6a

Browse files
committed
Don't set request body when the body is not given (fixes GET requests)
1 parent f34c0c6 commit 91e4d6a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/openstax/payments/api/real_client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def absolutize_url(url)
6969
Addressable::URI.join @server_url, url.to_s
7070
end
7171

72-
def api_request(method:, url:, body: {})
72+
def api_request(method:, url:, body: nil)
7373
absolute_uri = absolutize_url(url)
7474

75-
request_options = HEADER_OPTIONS.merge({ body: body.to_json })
75+
request_options = HEADER_OPTIONS.merge(body.nil? ? {} : { body: body.to_json })
7676

7777
begin
7878
num_retries ||= 0

0 commit comments

Comments
 (0)