mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
handle fixedMethod
This commit is contained in:
parent
b3ad2efc8f
commit
e7c0693100
@ -29,13 +29,14 @@ export default class ComplexController {
|
||||
|
||||
global.VALID_HTTP_METHODS.forEach((httpMethod) => {
|
||||
if (typeof this[httpMethod] === "object") {
|
||||
const fixedMethod = global.FIXED_HTTP_METHODS[httpMethod]
|
||||
const controllerMethods = Object.keys(this[httpMethod])
|
||||
|
||||
controllerMethods.forEach((methodKey) => {
|
||||
const fn = this[httpMethod][methodKey]
|
||||
|
||||
let endpoint = {
|
||||
method: httpMethod,
|
||||
method: fixedMethod,
|
||||
route: methodKey,
|
||||
middlewares: [],
|
||||
fn: fn,
|
||||
|
@ -14,7 +14,10 @@ const { randomWord } = require("@corenode/utils")
|
||||
const { serverManifest } = require("../lib")
|
||||
|
||||
global.LOCALHOST_ADDRESS = net.ip.getHostAddress() ?? "localhost"
|
||||
global.VALID_HTTP_METHODS = ["get", "post", "put", "patch", "del", "trace", "head", "any", "options", "ws"]
|
||||
global.FIXED_HTTP_METHODS = {
|
||||
"delete": "del",
|
||||
}
|
||||
global.VALID_HTTP_METHODS = ["get", "post", "put", "patch", "del", "delete", "trace", "head", "any", "options", "ws"]
|
||||
global.DEFAULT_HEADERS = {
|
||||
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
|
Loading…
x
Reference in New Issue
Block a user