Skip to content

Commit

Permalink
Use HEAD instead of GET to ping Colore (#26)
Browse files Browse the repository at this point in the history
Reduces the amount of data received and the stress on the server
  • Loading branch information
tagliala authored Jan 20, 2025
1 parent c50d2d6 commit f8492e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 51 deletions.
2 changes: 1 addition & 1 deletion lib/colore/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def generate_doc_id
# Tests the connection with Colore. Will raise an error if the connection cannot be
# established.
def ping
send_request :get, '/'
send_request :head, '/'
true
end

Expand Down
63 changes: 14 additions & 49 deletions spec/fixtures/cassettes/Colore_Client/_ping/runs.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/lib/colore/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
end

it 'raises ColoreUnavailable on ECONNREFUSED' do
allow(client.send(:connection)).to receive(:get) { raise Faraday::ConnectionFailed }
allow(client.send(:connection)).to receive(:head) { raise Faraday::ConnectionFailed }
expect { client.ping }.to raise_error(Colore::Errors::ColoreUnavailable)
end
end
Expand Down

0 comments on commit f8492e3

Please sign in to comment.