Skip to content

Commit

Permalink
Version Bump v2.1.0: Automatically add Content-Type: application/json…
Browse files Browse the repository at this point in the history
… when there is a request body
  • Loading branch information
thinkingserious committed Jun 11, 2016
1 parent 7c779cf commit 4d618ed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](http://semver.org/).

## [2.1.0] - 2016-06-10
### Added
- Automatically add Content-Type: application/json when there is a request body

## [2.0.0] - 2016-06-03
### Changed
- Made the Response variables non-redundant. e.g. response.response_body becomes response.body
Expand Down
3 changes: 1 addition & 2 deletions examples/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# This example uses the SendGrid API as an example
headers = JSON.parse('
{
"Authorization": "Bearer ' + ENV['SENDGRID_API_KEY'] + '",
"Content-Type": "application/json"
"Authorization": "Bearer ' + ENV['SENDGRID_API_KEY'] + '"
}
')
host = 'https://api.sendgrid.com'
Expand Down
3 changes: 3 additions & 0 deletions lib/ruby_http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ def build_request(name, args)
request = net_http.new(uri.request_uri)
request = build_request_headers(request)
request.body = @request_body.to_json if @request_body
if request.body
request['Content-Type'] = 'application/json'
end
make_request(http, request)
end

Expand Down
2 changes: 1 addition & 1 deletion ruby_http_client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
spec.name = 'ruby_http_client'
spec.version = '2.0.0'
spec.version = '2.1.0'
spec.authors = ['Elmer Thomas']
spec.email = '[email protected]'
spec.summary = 'A simple REST client'
Expand Down

0 comments on commit 4d618ed

Please sign in to comment.