Page MenuHomePhabricator

Correctly redirect in Parsoid /transform/wikitext/to/lint endpoint
Closed, ResolvedPublic

Description

In Parsoid /transform/wikitext/to/lint endpoint, if I provide just the page title and no revision ID or wikitext body parameter, the endpoint 302 redirects me to the URI with the latest page revision. However, 302 redirects instruct clients to change the request method from POST to GET, while Parsoid doesn't support GET for that endpoint. So the correct way of redirecting would be 307 redirect that doesn't allow the client to change the request method.

Alternatively, Parsoid should support GET for that endpoint, or make the revision parameter required if no body is provided.

Related Objects

Event Timeline

Change 395880 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] T169006: Preserve request method when redirecting to oldid

https://gerrit.wikimedia.org/r/395880

Interesting, I didn't know about this 302/307 distinction .. it appears (based on a quick read) that browsers de-facto handle 302s incorrectly which led to introduction of 307 for stricter compliance.

Change 395880 merged by jenkins-bot:
[mediawiki/services/parsoid@master] T169006: Preserve request method when redirecting to oldid

https://gerrit.wikimedia.org/r/395880

Arlolra claimed this task.

Right now a POST to /v3/transform/wikitext/to/lint/{title} returns a 307 redirect to /en.wikipedia.org/v3/page/lint/{title}/{revision}, but the former URI doesn't exist - POST to it returns a 404, GET returns an error that {"error":"Invalid page format: lint"}.

The 307 redirect is preserving the request method, so it should point to /v3/transform/wikitext/to/lint/{title}/{revision}

Reopening.

Change 413425 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Redirect to the right path

https://gerrit.wikimedia.org/r/413425

Change 413425 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Redirect to the right path

https://gerrit.wikimedia.org/r/413425