Page MenuHomePhabricator

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


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

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 and hover over "Test previews no lead". as it's said in T182639 I see no popup.

Pchelolo claimed this task.
Pchelolo edited projects, added Services (done); removed Services (next).

Ok, I think this can be closed now.