Skip to content

Commit b2c7268

Browse files
fix leftovers
1 parent cc90b52 commit b2c7268

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

index.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const app = createApp({
3535
statusMessage: "Unauthorized",
3636
message: "Missing signature",
3737
});
38-
3938
if (type !== "Bearer" || token !== signature)
4039
throw createError({
4140
status: 401,
@@ -81,7 +80,9 @@ router.get(
8180
const lighthouseParams = z.object({
8281
url: z.string().url(),
8382
viewport: z.enum(["mobile", "desktop"]).default("mobile"),
84-
formats: z.array(z.enum(["html", "json"])).default(["json"]),
83+
html: z.string().default("false"),
84+
json: z.string().default("false"),
85+
csv: z.string().default("false"),
8586
});
8687
const configs = {
8788
mobile: lighthouseMobileConfig,
@@ -97,8 +98,9 @@ router.get(
9798
const results = await playAudit({
9899
reports: {
99100
formats: {
100-
html: query.formats.includes("html"),
101-
json: query.formats.includes("json"),
101+
html: query.html === "true",
102+
json: query.json === "true",
103+
csv: query.csv === "true",
102104
},
103105
},
104106
config: configs[query.viewport],
@@ -113,7 +115,7 @@ router.get(
113115
},
114116
});
115117
await context.close();
116-
return results;
118+
return JSON.parse(results.report);
117119
}),
118120
);
119121

0 commit comments

Comments
 (0)