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:
@@ -152,9 +152,9 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
# allow api clients to force errors for testing purposes.
|
# allow api clients to force errors for testing purposes.
|
||||||
def cause_error
|
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)
|
raise ArgumentError, "invalid status code" unless status.in?(400..599)
|
||||||
|
|
||||||
error = StandardError.new(params[:message])
|
error = StandardError.new(params[:message])
|
||||||
|
|||||||
Reference in New Issue
Block a user