refactor: Update validation error message in Transportation model clean method

This commit is contained in:
Sean Morley
2024-07-27 21:18:15 -04:00
parent 7c9afd8931
commit 581e5548d5
6 changed files with 249 additions and 84 deletions

View File

@@ -27,7 +27,7 @@ export async function PUT({ url, params, request, fetch, cookies }) {
}
export async function DELETE({ url, params, request, fetch, cookies }) {
return handleRequest(url, params, request, fetch, cookies);
return handleRequest(url, params, request, fetch, cookies, true);
}
// Implement other HTTP methods as needed (PUT, DELETE, etc.)
@@ -62,6 +62,14 @@ async function handleRequest(
body: request.method !== 'GET' && request.method !== 'HEAD' ? await request.text() : undefined
});
if (response.status === 204) {
// For 204 No Content, return a response with no body
return new Response(null, {
status: 204,
headers: response.headers
});
}
const responseData = await response.text();
return new Response(responseData, {