Properly fix empty body on GET/HEAD for CardDav/CalDav
Related to 47f443c300
This commit is contained in:
@@ -31,14 +31,14 @@ export const handler: Handler<Data, FreshContextState> = async (request, context
|
||||
const requestBodyText = await request.clone().text();
|
||||
|
||||
// Remove the `/carddav/` prefix from the hrefs in the request
|
||||
let parsedRequestBodyText = requestBodyText.replaceAll('<href>/carddav/', `<href>/`).replaceAll(
|
||||
let parsedRequestBodyText: string | undefined = requestBodyText.replaceAll('<href>/carddav/', `<href>/`).replaceAll(
|
||||
':href>/carddav/',
|
||||
`:href>/`,
|
||||
);
|
||||
|
||||
// The spec doesn't allow a body for GET or HEAD requests (and Deno fails if you try)
|
||||
if (request.method === 'GET' || request.method === 'HEAD') {
|
||||
parsedRequestBodyText = '';
|
||||
parsedRequestBodyText = undefined;
|
||||
}
|
||||
|
||||
const response = await fetch(`${contactsConfig.cardDavUrl}/${path}`, {
|
||||
|
||||
Reference in New Issue
Block a user