Make WordPress Core

Opened 8 years ago

Closed 6 years ago

#39704 closed enhancement (wontfix)

Consider returning pagination headers on out-of-bounds requests

Reported by: joehoyle's profile joehoyle Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: REST API Keywords:
Focuses: Cc:

Description

Since #39061 in 39967 we return an error if the request is for a page number that does not exist (because there are not enough results). In 4.7 we instead sent the pagination headers along with an empty array as the return (with no error).

It's feasible that the pagination information would still be useful in the case of an out of bounds error, so maybe we should add the headers back.

Change History (7)

This ticket was mentioned in Slack in #core-restapi by kadamwhite. View the logs.


8 years ago

#2 @kadamwhite
8 years ago

I would be in support of this, I would expect to get an error but I'd also like to be able to depend on those headers being available so I can be communicative in how I surface the issue to the consuming client.

This ticket was mentioned in Slack in #core-restapi by kadamwhite. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.


6 years ago

#5 @TimothyBlynJacobs
6 years ago

  • Type changed from defect (bug) to enhancement

We don't currently have a way to attach headers to WP_Error.

Would we have to worry about BC by changing to a WP_REST_Response being returned instead? Should this wait until WP_Error extends WP_Http_Response?

This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.


6 years ago

#7 @kadamwhite
6 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This was proposed as a nice-to-have that hasn't subsequently been missed much. In the REST API team chat today the component maintainers agreed that there doesn't seem to be a pressing need for this, and that the issue can be closed.

Note: See TracTickets for help on using tickets.