[wp-trac] [WordPress Trac] #46107: Scripts: Assign api-fetch nonce with corrected rest_nonce

WordPress Trac noreply at wordpress.org
Wed Mar 6 21:04:32 UTC 2019


#46107: Scripts: Assign api-fetch nonce with corrected rest_nonce
-----------------------------+---------------------
 Reporter:  aduth            |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  5.2
Component:  Script Loader    |     Version:  5.1
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |     Focuses:
-----------------------------+---------------------

Comment (by aduth):

 >It would be good to have the expected nonce behavior covered in a test,
 do you know if we have that already?

 I'm not aware of any. Is there precedent for how something like this would
 be tested? I could imagine one which tests that `wp-hooks` becomes added
 as a dependency of `wp-api-fetch`, but the main behavior here occurs in
 the browser in response to the heartbeat tick. Is that something which
 could be done in the QUnit tests? In Gutenberg, I could maybe imagine an
 end-to-end test forcing `wp.heartbeat.connectNow` and asserting in one way
 or another that the nonce used by the `apiFetch` middleware gets updated.
 Is there some equivalent we could implement in core? Maybe it ought to
 just be implemented in Gutenberg? Or as part of some future end-to-end
 tests implemented in core?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46107#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list