Skip to content

Commit

Permalink
fix: prevent errors from being cached (#2160)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickstaa committed Oct 9, 2022
1 parent 0a394a6 commit 4df8094
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));
}
};

1 comment on commit 4df8094

@vercel
Copy link

@vercel vercel bot commented on 4df8094 Oct 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.