Skip to content

Commit

Permalink
fix: prevent errors from being cached (anuraghazra#2160)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickstaa authored and devantler committed May 1, 2023
1 parent 8d53aa1 commit 41c60b0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default async (req, res) => {
}),
);
} catch (err) {
res.setHeader("Cache-Control", `no-store`); // Don't cache error responses.
return res.send(renderError(err.message, err.secondaryMessage));
}
};
1 change: 1 addition & 0 deletions api/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default async (req, res) => {
}),
);
} catch (err) {
res.setHeader("Cache-Control", `no-store`); // Don't cache error responses.
return res.send(renderError(err.message, err.secondaryMessage));
}
};
1 change: 1 addition & 0 deletions api/top-langs.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default async (req, res) => {
}),
);
} catch (err) {
res.setHeader("Cache-Control", `no-store`); // Don't cache error responses.
return res.send(renderError(err.message, err.secondaryMessage));
}
};
1 change: 1 addition & 0 deletions api/wakatime.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default async (req, res) => {
}),
);
} catch (err) {
res.setHeader("Cache-Control", `no-store`); // Don't cache error responses.
return res.send(renderError(err.message, err.secondaryMessage));
}
};

0 comments on commit 41c60b0

Please sign in to comment.