Skip to content

Commit

Permalink
Improve development/test env error messages for Stitches
Browse files Browse the repository at this point in the history
The current error message isn't helpful for development, so provide
a helpful hint in the Rails development and test environments.
  • Loading branch information
zorab47 committed Nov 9, 2023
1 parent 2dc42c8 commit 773dccd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/stitches/api_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ def do_call(env)
unauthorized_response("bad authorization type")
end
else
unauthorized_response("no authorization header")
message = "no authorization header"

if Rails.env.test? || Rails.env.development?
message += " (Development/Test Env Hint: Blocked by stitches; confirm your authorization header is set OR check the `allowlist_regex` config for this path)"
end

unauthorized_response(message)
end
end

Expand Down

0 comments on commit 773dccd

Please sign in to comment.