Skip to content

Commit

Permalink
Send request in params for DELETE if sending a body isn't requested
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjeffries committed Oct 1, 2021
1 parent 6c00121 commit 4f48f16
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.10.8

Bugfix:

- Flexirest didn't set DELETE params in the URL if send_request_body was false

## 1.10.7

Bugfix:
Expand Down
2 changes: 1 addition & 1 deletion lib/flexirest/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def prepare_params
if @explicit_parameters
params = @explicit_parameters
end
if http_method == :get
if http_method == :get || (http_method == :delete && !@method[:options][:send_delete_body] && proxy != :json_api)
@get_params = default_params.merge(params || {})
@post_params = nil
elsif http_method == :delete && @method[:options][:send_delete_body]
Expand Down
2 changes: 1 addition & 1 deletion lib/flexirest/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Flexirest
VERSION = "1.10.7"
VERSION = "1.10.8"
end
2 changes: 1 addition & 1 deletion spec/lib/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class WhitelistedDateClient < Flexirest::Base
end

it "should get an HTTP connection when called and call delete without a body if send_delete_body is not specified" do
expect_any_instance_of(Flexirest::Connection).to receive(:delete).with("/remove/1", "", an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:'{"result":true}', response_headers:{})))
expect_any_instance_of(Flexirest::Connection).to receive(:delete).with("/remove/1?something=else", "", an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:'{"result":true}', response_headers:{})))
ExampleClient.remove(id:1, something: "else")
end

Expand Down

0 comments on commit 4f48f16

Please sign in to comment.