Document the 405 for non-GET requests to a moved project

What does this MR do and why?

The Redirects section of the REST API page says that after a path change the API answers with a redirect to the new location. That holds for GET only. For any other method, find_project! in lib/api/helpers.rb answers a request that names a moved project by its old path with 405 Method Not Allowed:

if project_moved?(id, project)
  return not_allowed!('Non GET methods are not allowed for moved projects') unless request.get?

  return redirect!(url_with_project_id(project))
end

spec/requests/api/projects_spec.rb pins it for the archive endpoint (when a project is moved, returns 405 error). project_moved? is true only when :id is a path other than the project's current one, so a request that names the project by its ID or by its current path is never affected.

This adds that to the section: which methods are refused, the response body, and what to send instead.

The page says most endpoints rather than all of them. A few look the project up with find_project, which follows the redirect without this check, so a non-GET request that uses the old path is processed there as usual; POST /projects/:id/trigger/pipeline is one. HEAD is refused like the four methods the page lists, because Grape serves it through the GET endpoint and request.get? is false for it. I left it out of the list because its response has no body to show.

I found this while answering a review comment on !255704 (merged), where the 405 in the failure list of cancel_merge_when_pipeline_succeeds turned out to come from this helper rather than from the endpoint.

MR acceptance checklist

This change is documentation only. No endpoint, parameter or behaviour changes. markdownlint-cli2 with the repository's configuration reports no issues on the page, and Vale with the repository's styles reports nothing on the new lines; the page's reading level moves from 8.10 to 8.04.

Merge request reports

Loading
Loading