forked from lgwebdream/fe-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparseParams.js
More file actions
34 lines (30 loc) · 740 Bytes
/
parseParams.js
File metadata and controls
34 lines (30 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// const getBody = () => {};
const parseGet = ({ parameters }) => {
const getSchema = {};
if (!parameters) return getSchema;
for (const param of parameters) {
if (param.in === 'query') {
getSchema[param.name] = {
required: param.required,
};
}
}
return getSchema;
};
const parsePost = ({ requestBody }) => {
const { content } = requestBody;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const reqBody = content['application/json'];
return {};
};
const parseParams = (method, request) => {
switch (method) {
case 'get':
return parseGet(request);
case 'post':
return parsePost(request);
default:
return {};
}
};
module.exports = parseParams;