Added a comment for posterity

This commit is contained in:
Chris Raible 2024-08-30 00:18:32 -07:00
parent 4dc2f2f267
commit de49f096b1

View File

@ -188,8 +188,10 @@ export async function mockApi<Requests extends Record<string, MockRequestConfig>
let requestBody = null;
try {
// Try to parse the post data as JSON
requestBody = JSON.parse(route.request().postData() || 'null');
} catch {
// Post data isn't JSON (e.g. file upload) — use the raw post data
requestBody = route.request().postData();
}