Page MenuHomePhabricator

500 error returned for responses with validly empty bodies
Closed, ResolvedPublic

Description

In the MCS page summary API spec, 204 responses are expected in a couple of situations:

  • The page requested is outside the main namespace;
  • The page has a content model other than 'wikitext'.

However, it appears that HyperSwitch is converting empty responses (for non-HEAD requests) into 500 errors. This is surprising to clients and probably shouldn't happen for 204s, which should not have any body content.

(See T182399#3828497 for context.)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 11 2017, 7:03 PM
Mholloway updated the task description. (Show Details)Dec 11 2017, 7:04 PM
Mholloway updated the task description. (Show Details)

Actually, I think a strong case could be made that errors should be thrown in these cases rather than returning 204s, but we'd have to discuss that with the Reading Web team. @phuedx @Jdlrobson

Well, no, actually. 204 and 205 do not contain a body as per RfC 7231, so HyperSwitch is at fault here and should be fixed accordingly.

@mobrovac Ah, I mean to say that I agree HyperSwitch is handling this situation incorrectly, but also that from a client perspective 204s are potentially confusing, so perhaps the spec should be updated. But it's probably best not to confuse the issue here. :)

I've deployed my fix in beta, so now the summary for empty preview returns from RESTBase 200 and no content in the body.

O'm not sure if clients can handle that correctly as if I visit https://en.wikipedia.beta.wmflabs.org/wiki/Category:Page_Previews and hover over "Test previews no lead". as it's said in T182639 I see no popup.

Pchelolo closed this task as Resolved.Dec 13 2017, 11:09 PM
Pchelolo claimed this task.
Pchelolo edited projects, added Services (done); removed Services (next).

Ok, I think this can be closed now.