[wp-trac] [WordPress Trac] #47676: Add support for If-Unmodified-Since header to make a conditional request when updating posts via REST API (for offline and collaborative editing)

WordPress Trac noreply at wordpress.org
Thu Jul 11 13:51:23 UTC 2019


#47676: Add support for If-Unmodified-Since header to make a conditional request
when updating posts via REST API (for offline and collaborative editing)
--------------------------------------+------------------------------
 Reporter:  westonruter               |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Editor                    |     Version:  4.7
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  rest-api
--------------------------------------+------------------------------

Comment (by TimothyBlynJacobs):

 Why `If-Unmodified-Since` instead of using ETag's? An ETag could be built
 by serializing the item response. That would handle updates to the entity
 that don't trigger `post_modified` like metadata, terms, and any other
 custom fields.

 Or is the fact that `post_modified` would only track changes to the post
 resource a benefit?

 One downside to an ETag is it'd be more intensive to calculate. I suppose
 if we wanted to get similar benefits, we could force a `post_modified`
 update whenever a post entity is updated through the posts controller.

 -----

 If the `If-Unmodified-Since` is used I think we should definitely send
 `Last-Modified` as a header, and ideally support `If-Modified-Since` as
 well. `Last-Modified` can also be sent as a [https://json-
 schema.org/latest/json-schema-hypermedia.html#rfc.section.6.5.5
 targetHint] so it is accessible in the collection route.

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


More information about the wp-trac mailing list