Return partial city detail batches

This commit is contained in:
2569718930@qq.com
2026-05-31 19:51:28 +08:00
parent d3f444dbf6
commit 78ea0326a5
7 changed files with 139 additions and 16 deletions
+7 -4
View File
@@ -85,6 +85,7 @@ export async function proxyBackendJsonGet(
req: NextRequest,
options: {
cacheControl?: string;
cacheControlForData?: (data: unknown) => string | undefined;
conditionalResponse?: boolean;
detailLimit?: number;
error?: string;
@@ -148,12 +149,14 @@ export async function proxyBackendJsonGet(
const data = await (timing
? timing.measure("backend_read", () => res.json())
: res.json());
const responseCacheControl =
options.cacheControlForData?.(data) ?? options.cacheControl;
const response =
options.cacheControl && options.conditionalResponse !== false
? buildCachedJsonResponse(req, data, options.cacheControl)
responseCacheControl && options.conditionalResponse !== false
? buildCachedJsonResponse(req, data, responseCacheControl)
: NextResponse.json(data, {
headers: options.cacheControl
? { "Cache-Control": options.cacheControl }
headers: responseCacheControl
? { "Cache-Control": responseCacheControl }
: undefined,
});
const withCookies = applyAuthResponseCookies(response, auth.response);