Fixed admin-x-settings tests failing because postData was not JSON
This commit is contained in:
parent
d959bdb914
commit
4dc2f2f267
@ -186,7 +186,12 @@ export async function mockApi<Requests extends Record<string, MockRequestConfig>
|
||||
});
|
||||
}
|
||||
|
||||
const requestBody = JSON.parse(route.request().postData() || 'null');
|
||||
let requestBody = null;
|
||||
try {
|
||||
requestBody = JSON.parse(route.request().postData() || 'null');
|
||||
} catch {
|
||||
requestBody = route.request().postData();
|
||||
}
|
||||
|
||||
lastApiRequests[matchingMock.name] = {
|
||||
body: requestBody,
|
||||
|
Loading…
Reference in New Issue
Block a user