Handle CSRF errors for JSON requests

Description

Currently, the handler for CSRF errors works for HTML requests and JS requests, but not for JSON requests:

This is resulting in a lot of errors from the hit count endpoint in New Relic. The handler should be modified to return a reasonable value for JSON requests. (In fact, since the JS handler returns JSON, it might work to just return the same thing for both JS and JSON requests.)

Testing Instructions:

  1. Disable all cookies.

  2. View a work on staging.

  3. Make sure that the ActionController::UnknownFormat error doesn't appear in New Relic.

Activity

Show:
james_
June 17, 2020, 9:10 AM
Edited

 

looks good to me

Assignee

ticking instant

Reporter

ticking instant

Roadmap

Misc

Priority

Medium

Affects versions

Fix versions

Components

BackEnd

Difficulty

Medium

Required Access Level

Admin

Milestone

Internal 0.9
Configure