api: rename error url param to cause_error.

Rename the `error` url param to `cause_error`. Using this param causes
Danbooru to return an error response for testing purposes. Calling this
param `error` caused problems when OAuth2 authorization failed and the
user was redirected back to Danbooru with the `error` param set.
This commit is contained in:
evazion
2020-05-23 22:01:29 -05:00
parent 364343453c
commit 5da04db9cd

View File

@@ -152,9 +152,9 @@ class ApplicationController < ActionController::Base
# allow api clients to force errors for testing purposes.
def cause_error
return unless params[:error].present?
return unless params[:cause_error].present?
status = params[:error].to_i
status = params[:cause_error].to_i
raise ArgumentError, "invalid status code" unless status.in?(400..599)
error = StandardError.new(params[:message])