fix(striker-ui-api): ignore empty body when create server

main
Tsu-ba-me 2 years ago
parent a65b82d9ee
commit 06c3b9bae4
  1. 9
      striker-ui-api/src/lib/request_handlers/server/createServer.ts

@ -9,8 +9,8 @@ import { dbQuery, sub } from '../../accessModule';
export const createServer: RequestHandler = ({ body }, response) => {
console.log('Creating server.');
console.dir(body, { depth: null });
if (body) {
const {
serverName,
cpuCores,
@ -22,9 +22,7 @@ export const createServer: RequestHandler = ({ body }, response) => {
driverISOFileUUID,
anvilUUID,
optimizeForOS,
} = body;
console.dir(body, { depth: null });
} = body || {};
const dataServerName = String(serverName);
const dataOS = String(optimizeForOS);
@ -87,7 +85,7 @@ export const createServer: RequestHandler = ({ body }, response) => {
`Failed to assert value when trying to provision a server; CAUSE: ${assertError}.`,
);
response.status(500).send();
response.status(400).send();
return;
}
@ -151,7 +149,6 @@ driver_iso=${dataDriverISO}`;
job_host_uuid: provisionServerJobHostUUID,
},
});
}
response.status(202).send();
};

Loading…
Cancel
Save