[wp-trac] [WordPress Trac] #52691: Check if JSONP is enabled prior to outputting the jsonp-type content-type

WordPress Trac noreply at wordpress.org
Tue Mar 2 01:25:53 UTC 2021


#52691: Check if JSONP is enabled prior to outputting the jsonp-type content-type
--------------------------+-----------------------------
 Reporter:  dd32          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  lowest        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:
 Severity:  trivial       |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 Currently when JSONP is disabled, the `Content-Type` header is still
 output as if the response will be a jsonp response (But it won't be).

 The attached PR simply runs the filter before outputting the header.

 This still isn't strictly correct for all cases, as an invalid jsonp
 callback will still output non-jsonp using the jsonp content-type, but
 that's not a regression here, and I wasn't sure about shifting the invalid
 jsonp callback sanitization earlier in the function.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52691>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list