Feature: upload api now support url query picbed and configname

ISSUES CLOSED: #93
This commit is contained in:
萌萌哒赫萝
2023-09-06 08:40:50 -07:00
parent f9a3f24c2f
commit 2fcec70721
8 changed files with 88 additions and 18 deletions
+6 -4
View File
@@ -44,8 +44,9 @@ class Server {
}
if (request.method === 'POST') {
if (!routers.getHandler(request.url!)) {
logger.warn(`[PicList Server] don't support [${request.url}] url`)
const [url, query] = request.url!.split('?')
if (!routers.getHandler(url!)) {
logger.warn(`[PicList Server] don't support [${url}] url`)
handleResponse({
response,
statusCode: 404,
@@ -73,10 +74,11 @@ class Server {
})
}
logger.info('[PicList Server] get the request', body)
const handler = routers.getHandler(request.url!)
const handler = routers.getHandler(url!)?.handler
handler!({
...postObj,
response
response,
urlparams: query ? new URLSearchParams(query) : undefined
})
})
}