From 89e7107a47df05199c0e6b8b600b1964d6c006a3 Mon Sep 17 00:00:00 2001 From: Fred KISSIE Date: Tue, 3 Mar 2026 03:31:43 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20use=20`put`=20and=20return?= =?UTF-8?q?=20`200=20OK`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/routers/external.ts | 6 +++--- server/routers/integration.ts | 6 +++--- server/routers/policy/setResourcePolicyHeaderAuth.ts | 4 ++-- server/routers/policy/setResourcePolicyPassword.ts | 4 ++-- server/routers/policy/setResourcePolicyPincode.ts | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/server/routers/external.ts b/server/routers/external.ts index 17c4a2558..379ff794c 100644 --- a/server/routers/external.ts +++ b/server/routers/external.ts @@ -734,7 +734,7 @@ authenticated.post( resource.setResourcePolicyUsers ); -authenticated.post( +authenticated.put( "/resource-policy/:resourcePolicyId/password", verifyResourcePolicyAccess, verifyLimits, @@ -743,7 +743,7 @@ authenticated.post( policy.setResourcePolicyPassword ); -authenticated.post( +authenticated.put( "/resource-policy/:resourcePolicyId/pincode", verifyResourcePolicyAccess, verifyLimits, @@ -752,7 +752,7 @@ authenticated.post( policy.setResourcePolicyPincode ); -authenticated.post( +authenticated.put( "/resource-policy/:resourcePolicyId/header-auth", verifyResourcePolicyAccess, verifyLimits, diff --git a/server/routers/integration.ts b/server/routers/integration.ts index 223a8a24f..52c839b18 100644 --- a/server/routers/integration.ts +++ b/server/routers/integration.ts @@ -632,7 +632,7 @@ authenticated.put( policy.setResourcePolicyAccessControl ); -authenticated.post( +authenticated.put( "/resource-policy/:resourcePolicyId/password", verifyApiKeyResourcePolicyAccess, verifyLimits, @@ -641,7 +641,7 @@ authenticated.post( policy.setResourcePolicyPassword ); -authenticated.post( +authenticated.put( "/resource-policy/:resourcePolicyId/pincode", verifyApiKeyResourcePolicyAccess, verifyLimits, @@ -650,7 +650,7 @@ authenticated.post( policy.setResourcePolicyPincode ); -authenticated.post( +authenticated.put( "/resource-policy/:resourcePolicyId/header-auth", verifyApiKeyResourcePolicyAccess, verifyLimits, diff --git a/server/routers/policy/setResourcePolicyHeaderAuth.ts b/server/routers/policy/setResourcePolicyHeaderAuth.ts index 02ab11728..34c55b750 100644 --- a/server/routers/policy/setResourcePolicyHeaderAuth.ts +++ b/server/routers/policy/setResourcePolicyHeaderAuth.ts @@ -21,7 +21,7 @@ const setResourcePolicyHeaderAuthBodySchema = z.strictObject({ }); registry.registerPath({ - method: "post", + method: "put", path: "/resource-policy/{resourcePolicyId}/header-auth", description: "Set or update the header authentication for a resource policy. If user and password is not provided, it will remove the header authentication.", @@ -100,7 +100,7 @@ export async function setResourcePolicyHeaderAuth( success: true, error: false, message: "Header Authentication set successfully", - status: HttpCode.CREATED + status: HttpCode.OK }); } catch (error) { logger.error(error); diff --git a/server/routers/policy/setResourcePolicyPassword.ts b/server/routers/policy/setResourcePolicyPassword.ts index c7559b75e..d3072d7d9 100644 --- a/server/routers/policy/setResourcePolicyPassword.ts +++ b/server/routers/policy/setResourcePolicyPassword.ts @@ -20,7 +20,7 @@ const setResourcePolicyPasswordBodySchema = z.strictObject({ }); registry.registerPath({ - method: "post", + method: "put", path: "/resource-policy/{resourcePolicyId}/password", description: "Set the password for a resource policy. Setting the password to null will remove it.", @@ -95,7 +95,7 @@ export async function setResourcePolicyPassword( success: true, error: false, message: "Resource policy password set successfully", - status: HttpCode.CREATED + status: HttpCode.OK }); } catch (error) { logger.error(error); diff --git a/server/routers/policy/setResourcePolicyPincode.ts b/server/routers/policy/setResourcePolicyPincode.ts index d16e05c9e..08f195ff3 100644 --- a/server/routers/policy/setResourcePolicyPincode.ts +++ b/server/routers/policy/setResourcePolicyPincode.ts @@ -23,7 +23,7 @@ const setResourcePolicyPincodeBodySchema = z.strictObject({ }); registry.registerPath({ - method: "post", + method: "put", path: "/resource-policy/{resourcePolicyId}/pincode", description: "Set the PIN code for a resource policy. Setting the PIN code to null will remove it.", @@ -98,7 +98,7 @@ export async function setResourcePolicyPincode( success: true, error: false, message: "Resource policy PIN code set successfully", - status: HttpCode.CREATED + status: HttpCode.OK }); } catch (error) { logger.error(error);