Skip to content

Commit 2004a23

Browse files
Version Bump v2.2.1: Fix edge case for POST
1 parent 4d618ed commit 2004a23

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
33

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

6+
## [2.1.1] - 2016-06-10
7+
### Fix
8+
- Deal with an edge case where when you send a POST with no body, net/http sets the content type to application/x-www-form-urlencoded
9+
610
## [2.1.0] - 2016-06-10
711
### Added
812
- Automatically add Content-Type: application/json when there is a request body

lib/ruby_http_client.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ def build_request(name, args)
150150
request.body = @request_body.to_json if @request_body
151151
if request.body
152152
request['Content-Type'] = 'application/json'
153+
elsif !request.body and (name = "post")
154+
request['Content-Type'] = ''
153155
end
154156
make_request(http, request)
155157
end

ruby_http_client.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
44

55
Gem::Specification.new do |spec|
66
spec.name = 'ruby_http_client'
7-
spec.version = '2.1.0'
7+
spec.version = '2.1.1'
88
spec.authors = ['Elmer Thomas']
99
spec.email = '[email protected]'
1010
spec.summary = 'A simple REST client'

0 commit comments

Comments
 (0)