add new resource header + make the location header an absolute url
This commit is contained in:
@@ -14,7 +14,8 @@ export const detailHandlers = [
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: id,
|
||||
Location: req.url.href + '/' + id,
|
||||
'Umb-Generated-Resource': id,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -13,7 +13,8 @@ export const folderHandlers = [
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: id,
|
||||
Location: req.url.href + '/' + id,
|
||||
'Umb-Generated-Resource': id,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -14,7 +14,8 @@ export const detailHandlers = [
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: id,
|
||||
Location: req.url.href + '/' + id,
|
||||
'Umb-Generated-Resource': id,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -14,7 +14,8 @@ export const detailHandlers = [
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: id,
|
||||
Location: req.url.href + '/' + id,
|
||||
'Umb-Generated-Resource': id,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -13,7 +13,8 @@ export const folderHandlers = [
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: id,
|
||||
Location: req.url.href + '/' + id,
|
||||
'Umb-Generated-Resource': id,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -9,10 +9,12 @@ export const detailHandlers = [
|
||||
const requestBody = (await req.json()) as CreateStylesheetRequestModel;
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
const path = umbPartialViewMockDB.file.create(requestBody);
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(path),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -9,11 +9,13 @@ export const folderHandlers = [
|
||||
const requestBody = (await req.json()) as CreatePartialViewFolderRequestModel;
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
const path = umbPartialViewMockDB.folder.create(requestBody);
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(path),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -13,11 +13,13 @@ export const renameHandlers = [
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
|
||||
const newPath = umbPartialViewMockDB.file.rename(decodeURIComponent(path), requestBody.name);
|
||||
const encodedPath = encodeURIComponent(newPath);
|
||||
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(newPath),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -9,10 +9,12 @@ export const detailHandlers = [
|
||||
const requestBody = (await req.json()) as CreateStylesheetRequestModel;
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
const path = umbScriptMockDb.file.create(requestBody);
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(path),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -9,11 +9,13 @@ export const folderHandlers = [
|
||||
const requestBody = (await req.json()) as CreateScriptFolderRequestModel;
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
const path = umbScriptMockDb.folder.create(requestBody);
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(path),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -13,11 +13,13 @@ export const renameHandlers = [
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
|
||||
const newPath = umbScriptMockDb.file.rename(decodeURIComponent(path), requestBody.name);
|
||||
const encodedPath = encodeURIComponent(newPath);
|
||||
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(newPath),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -9,10 +9,13 @@ export const detailHandlers = [
|
||||
const requestBody = (await req.json()) as CreateStylesheetRequestModel;
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
const path = umbStylesheetMockDb.file.create(requestBody);
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(path),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -10,11 +10,13 @@ export const folderHandlers = [
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
|
||||
const path = umbStylesheetMockDb.folder.create(requestBody);
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(path),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -13,11 +13,13 @@ export const renameHandlers = [
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
|
||||
const newPath = umbStylesheetMockDb.file.rename(decodeURIComponent(path), requestBody.name);
|
||||
const encodedPath = encodeURIComponent(newPath);
|
||||
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: encodeURIComponent(newPath),
|
||||
Location: req.url.href + '/' + encodedPath,
|
||||
'Umb-Generated-Resource': encodedPath,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -15,7 +15,13 @@ export const handlers = [
|
||||
|
||||
if (!userId) return res(ctx.status(400));
|
||||
|
||||
return res(ctx.status(201), ctx.set('Location', userId));
|
||||
return res(
|
||||
ctx.status(201),
|
||||
ctx.set({
|
||||
Location: req.url.href + '/' + userId,
|
||||
'Umb-Generated-Resource': userId,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
||||
rest.post<any>(umbracoPath(`${inviteSlug}/resend`), async (req, res, ctx) => {
|
||||
|
||||
Reference in New Issue
Block a user