mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
support urlencoded
This commit is contained in:
parent
a815c07a2d
commit
9a5296661f
@ -294,6 +294,20 @@ class Server {
|
|||||||
throw new Error("Endpoint is disabled!")
|
throw new Error("Endpoint is disabled!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure req has an body and query
|
||||||
|
if (typeof req.body === "undefined") {
|
||||||
|
req.body = {}
|
||||||
|
}
|
||||||
|
if (typeof req.query === "undefined") {
|
||||||
|
req.query = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if server has enabled urlencoded parser, parse the body
|
||||||
|
if (this.params.urlencoded) {
|
||||||
|
req.body = await req.urlencoded()
|
||||||
|
}
|
||||||
|
|
||||||
|
// return the returning call of the endpoint function
|
||||||
return await endpoint.fn(req, res)
|
return await endpoint.fn(req, res)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (typeof this.params.onRouteError === "function") {
|
if (typeof this.params.onRouteError === "function") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user