[04:09:28] https://tools.wmflabs.org/mwpackages/api.json (API for https://tools.wmflabs.org/mwpackages/) [13:46:11] <_joe_> duesen: say in MediaWiki I want, at some point, return a 304 response [13:46:40] <_joe_> is there a method to do so programmatically, or I just need to set $response->header() [13:58:23] _joe_: Depends. If you want a body with that, it's probably better to use OutputPage::setStatusCode [13:58:44] response also has setStatusHeader for conveniance [13:58:50] <_joe_> a 304 should /never/ have a body [13:59:11] <_joe_> so I expected MediaWiki to have a standard way to set 304 and hence no body in the response [14:00:02] <_joe_> and yes, probably OutputPage::setStatusCode should take care of it? [14:01:27] <_joe_> to be more explicit, having a body in a 204 or 304 response is a violation of the HTTP protocol and nginx (amongst other servers) will refuse to serve it [14:01:48] <_joe_> I was asking because I saw this fix by Amir1 [14:01:50] <_joe_> https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Wikibase/+/552505/1/repo/includes/LinkedData/EntityDataRequestHandler.php [14:02:07] <_joe_> to a case where we're seeing such a behaviour [14:02:19] MW seems to already return 304s in numerous cases [14:02:23] But whether there's content with it... [14:02:31] <_joe_> and I was asking myself if there isn't a method to safeguard ourselves from returning content [14:02:37] <_joe_> Reedy: we mostly don't [14:02:52] What, return content or return 304s? [14:02:59] <_joe_> return content [23:48:50] _joe_: the REST API has ResponseFactory::createNotModified(), I don't think the web output code has anything similar [23:49:31] also, it does not actively prevent the user from setting a body, it just does not include one automatically