Skip to content

Commit

Permalink
pass only value for update
Browse files Browse the repository at this point in the history
  • Loading branch information
pixincreate committed Jan 7, 2025
1 parent 8bc2604 commit 06f3c42
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cypress-tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -3348,9 +3348,11 @@ Cypress.Commands.add("setConfigs", (globalState, key, value, requestType) => {
const baseUrl = globalState.get("baseUrl");
const url = `${baseUrl}/configs/${config.useKey ? key : ""}`;

const body = ["CREATE", "UPDATE"].includes(requestType)
? { key, value }
: undefined;
const getRequestBody = {
CREATE: () => ({ key, value }),
UPDATE: () => ({ value }),
};
const body = getRequestBody[requestType]?.() || undefined;

cy.request({
method: config.method,
Expand Down

0 comments on commit 06f3c42

Please sign in to comment.