Skip to content

Commit 8538565

Browse files
committed
Add all method support
1 parent 3b0ee68 commit 8538565

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/service/CoaRouter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as querystring from 'querystring'
77
export interface CoaRouterOptions {
88
name?: string
99
desc?: string
10-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
10+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'ALL'
1111
param?: { [i: string]: any }
1212
result?: { [i: string]: any }
1313
delete?: boolean
@@ -112,7 +112,7 @@ export class CoaRouter<T> {
112112
}
113113

114114
layer || CoaError.throw('Gateway.NotFound', '网关接口不存在')
115-
layer.method === method || CoaError.throw('Gateway.MethodNotAllowed', '当前网关接口请求方式不被允许')
115+
layer.method === 'ALL' || layer.method === method || CoaError.throw('Gateway.MethodNotAllowed', '当前网关接口请求方式不被允许')
116116
const handler = layer.handler || CoaError.throw('Gateway.HandlerNotFound', '当前网关接口处理方法不存在')
117117
const group = layer.group
118118

0 commit comments

Comments
 (0)