mirror of
https://github.com/azures04/crafatar.git
synced 2026-05-06 11:00:39 +02:00
downstream caches shouldn't cache server errors, fixes #136
This commit is contained in:
@@ -4,7 +4,7 @@ var crc = require("crc").crc32;
|
|||||||
|
|
||||||
var human_status = {
|
var human_status = {
|
||||||
"-2": "user error", // e.g. invalid size
|
"-2": "user error", // e.g. invalid size
|
||||||
"-1": "server error", // e.g. network issues
|
"-1": "server error", // e.g. mojang/network issues
|
||||||
0: "none", // cached as null (user has no skin)
|
0: "none", // cached as null (user has no skin)
|
||||||
1: "cached", // found on disk
|
1: "cached", // found on disk
|
||||||
2: "downloaded", // profile downloaded, skin downloaded from mojang servers
|
2: "downloaded", // profile downloaded, skin downloaded from mojang servers
|
||||||
@@ -85,6 +85,8 @@ module.exports = function(request, response, result) {
|
|||||||
if (result.status === -2) {
|
if (result.status === -2) {
|
||||||
response.writeHead(result.code || 422, headers);
|
response.writeHead(result.code || 422, headers);
|
||||||
} else if (result.status === -1) {
|
} else if (result.status === -1) {
|
||||||
|
// 500 responses shouldn't be cached
|
||||||
|
headers["Cache-Control"] = "private, max-age=0, no-cache";
|
||||||
response.writeHead(500, headers);
|
response.writeHead(500, headers);
|
||||||
} else {
|
} else {
|
||||||
if (result.body) {
|
if (result.body) {
|
||||||
|
|||||||
Reference in New Issue
Block a user