From 98cbffa590ec2e4e3dc9826712cb4620fee88a40 Mon Sep 17 00:00:00 2001 From: MICHAEL JACKSON Date: Thu, 31 Aug 2017 09:00:25 -0700 Subject: [PATCH] Use explicit status codes --- server/middleware/packageURL.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/middleware/packageURL.js b/server/middleware/packageURL.js index 77dbc9c..ff527e6 100644 --- a/server/middleware/packageURL.js +++ b/server/middleware/packageURL.js @@ -49,21 +49,21 @@ function packageURL(req, res, next) { // Redirect /_meta/path to /path?meta. if (req.path.match(/^\/_meta\//)) { req.query.meta = '' - return res.redirect(req.path.substr(6) + createSearch(req.query)) + return res.redirect(302, req.path.substr(6) + createSearch(req.query)) } // Redirect /path?json => /path?meta if (req.query.json != null) { delete req.query.json req.query.meta = '' - return res.redirect(req.path + createSearch(req.query)) + return res.redirect(302, req.path + createSearch(req.query)) } // Redirect requests with unknown query params to their equivalents // with only known params so they can be served from the cache. This // prevents people using random query params designed to bust the cache. if (!queryIsKnown(req.query)) - return res.redirect(req.path + createSearch(sanitizeQuery(req.query))) + return res.redirect(302, req.path + createSearch(sanitizeQuery(req.query))) const url = parsePackageURL(req.url)