Skip to content

Commit

Permalink
fix rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
omohokcoj committed Oct 15, 2023
1 parent 85c76b6 commit 9c21fc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions app/controllers/motor/run_api_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ def create

private

# rubocop:disable Metrics/AbcSize
def respond_with_result
response = Motor::ApiConfigs.run(find_or_initialize_api_config,
method: request_params[:method],
path: request_params[:path],
body: request_params[:body],
params: request_params[:params],
headers: { 'Authorization' => "Bearer #{current_user_jwt}" })
response.to_hash.each do |key, (value)|
next if key.downcase == 'transfer-encoding'
response.to_hash.each do |key, (value)|
next if key.casecmp('transfer-encoding').zero?

headers[key] = value
end

self.response_body = response.body
self.status = response.code.to_i
end
# rubocop:enable Metrics/AbcSize

def find_or_initialize_api_config
Motor::ApiConfig.find_by(name: request_params[:api_config_name]) ||
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/motor/run_graphql_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ def respond_with_result
query: request_params[:query],
variables: request_params[:variables],
headers: { 'Authorization' => "Bearer #{current_user_jwt}" })
response.to_hash.each do |key, (value)|
next if key.downcase == 'transfer-encoding'
response.to_hash.each do |key, (value)|
next if key.casecmp('transfer-encoding').zero?

headers[key] = value
end

Expand Down

0 comments on commit 9c21fc4

Please sign in to comment.