Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/octokit/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module Connection

# Header keys that can be passed in options hash to {#get},{#head}
CONVENIENCE_HEADERS = Set.new(%i[accept content_type])
SUCCESSFUL_RESPONSES = (200..299)

# Make a HTTP GET request
#
Expand Down Expand Up @@ -167,7 +168,7 @@ def request(method, path, data, options = {})
# @return [Boolean] True on success, false otherwise
def boolean_from_response(method, path, options = {})
request(method, path, options)
[201, 202, 204].include? @last_response.status
SUCCESSFUL_RESPONSES.cover? @last_response.status
rescue Octokit::NotFound
false
end
Expand Down
4 changes: 2 additions & 2 deletions spec/octokit/client/actions_workflow_runs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
end

it 'returns false if request returns unexpected status' do
request = stub_post("repos/#{@test_repo}/actions/runs/#{@run_id}/rerun").to_return(status: 205)
request = stub_post("repos/#{@test_repo}/actions/runs/#{@run_id}/rerun").to_return(status: 300)

response = @client.rerun_workflow_run(@test_repo, @run_id)

Expand All @@ -124,7 +124,7 @@
end

it 'returns false if the request returns unexpected status' do
request = stub_post("repos/#{@test_repo}/actions/runs/#{@run_id}/cancel").to_return(status: 205)
request = stub_post("repos/#{@test_repo}/actions/runs/#{@run_id}/cancel").to_return(status: 300)

response = @client.cancel_workflow_run(@test_repo, @run_id)

Expand Down