Skip to content

Commit

Permalink
improve: removed defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
james-a-morris committed Nov 6, 2023
1 parent b951ba7 commit 89ce06a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1260,16 +1260,16 @@ export function getDefaultRelayerAddress(
export function sendResponse(
response: VercelResponse,
body: Record<string, unknown>,
statusCode = 200,
cacheSeconds = 300,
staleWhileRevalidateSeconds?: number
statusCode: number,
cacheSeconds: number,
staleWhileRevalidateSeconds: number
) {
if (cacheSeconds > 0) {
// Per Vercel's documentation, Vercel will only cache a response when
// the status code is 200. I.e. we can always set a cache policy
response.setHeader(
"Cache-Control",
(staleWhileRevalidateSeconds ?? 0) > 0
staleWhileRevalidateSeconds > 0
? `s-maxage=${cacheSeconds}, stale-while-revalidate=${staleWhileRevalidateSeconds}`
: `s-maxage=${cacheSeconds}`
);
Expand Down

0 comments on commit 89ce06a

Please sign in to comment.