Closed SkypLabs closed 2 years ago
Actually, both methods return the Link
HTTP header so it's not a mistake but an inconsistency.
Would you prefer specifying in the documentation that both methods work, or sticking to only one of them to keep the documentation consistent?
Hi @SkypLabs,
Yeah this intentionally is a HEAD
request not an OPTIONS
request. Any HTTP method will work, WordPress Core adds the header to all responses. So I don't think we need to call out the OPTIONS
request method specifically.
Hi @TimothyBJacobs,
Don't you think the documentation could be improved to specify somewhere that both HEAD
and OPTIONS
return the Link
HTTP header? As someone new to WordPress development, it was confusing to me to read on one page that I need to use a HEAD
request, and then on another page that I need to use an OPTIONS
request instead.
No I don't think so because the methods are different. A HEAD
request returns only the response headers for the endpoint. An OPTIONS
request returns information about what data the endpoint accepts and returns via the argument information and schema information.
When you are doing the discovery process, you only need to do a HEAD
request if you don't have need for the additional data that an OPTIONS
request provides and a HEAD
request is in fact preferable.
That makes sense. Thanks for the clarification.
As explained on the "Reference" page, the REST API discovery process is made available through
OPTIONS
requests, notHEAD
unlike what said on the "Discovery" page.This PR fixes this mistake.