File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ gem install ruby_http_client
2727``` ruby
2828require ' ruby_http_client'
2929global_headers = {' Authorization' => ' Basic XXXXXXX' }
30- client = SendGrid ::Client (host: ' base_url' , request_headers: global_headers)
30+ client = SendGrid ::Client . new (host: ' base_url' , request_headers: global_headers)
3131client.your.api._ (param).call.get
3232puts response.status_code
3333puts response.body
@@ -39,7 +39,7 @@ puts response.headers
3939``` ruby
4040require ' ruby_http_client'
4141global_headers = {' Authorization' => ' Basic XXXXXXX' }
42- client = SendGrid ::Client (host: ' base_url' , request_headers: global_headers)
42+ client = SendGrid ::Client . new (host: ' base_url' , request_headers: global_headers)
4343query_params = { ' hello' => 0 , ' world' => 1 }
4444request_headers = { ' X-Test' => ' test' }
4545data = { ' some' => 1 , ' awesome' => 2 , ' data' => 3 }
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ def build_request(name, args)
148148 request = net_http . new ( uri . request_uri )
149149 request = build_request_headers ( request )
150150 request . body = @request_body . to_json if @request_body
151- if request . body
151+ if request . body && ! @request_headers . has_key? ( 'Content-Type' )
152152 request [ 'Content-Type' ] = 'application/json'
153153 elsif !request . body and ( name . to_s == "post" )
154154 request [ 'Content-Type' ] = ''
You can’t perform that action at this time.
0 commit comments