Skip to content

Commit

Permalink
fix #18
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRuiz committed Nov 19, 2019
1 parent f46676a commit ed3f039
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/nice_http/http_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,13 @@ def delete(argument)

begin
@start_time_net = Time.now if @start_time_net.nil?
resp = @http.delete(path, headers_t)
if data.to_s == ""
resp = @http.delete(path, headers_t)
else
request = Net::HTTP::Delete.new(path, headers_t)
request.body = data
resp = @http.request(request)
end
data = resp.body
rescue Exception => stack
@logger.warn stack
Expand Down
2 changes: 1 addition & 1 deletion nice_http.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'nice_http'
s.version = '1.7.22'
s.version = '1.7.23'
s.summary = "NiceHttp -- simplest library for accessing and testing HTTP and REST resources. Get http logs and statistics automatically. Use hashes on your requests. Access JSON even easier."
s.description = "NiceHttp -- simplest library for accessing and testing HTTP and REST resources. Get http logs and statistics automatically. Use hashes on your requests. Access JSON even easier."
s.authors = ["Mario Ruiz"]
Expand Down
6 changes: 6 additions & 0 deletions spec/nice_http/delete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@
content = File.read("./nice_http.log")
expect(content).to match /There was a problem converting to json/
end

it "accepts data to be part of the request to send" do
resp = @http.delete({path: "/api/users/2", data: [33]})
expect(resp.code).to eq 204
end

end

0 comments on commit ed3f039

Please sign in to comment.