badmfck-api-server 1.2.9 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -136,14 +136,16 @@ class APIService extends BaseService_1.BaseService {
136
136
  };
137
137
  let result;
138
138
  try {
139
- let interceptorResult;
140
- if (this.options.interceptor) {
141
- interceptorResult = await this.options.interceptor.execute(httpRequest);
142
- if (interceptorResult.error) {
143
- this.sendResponse(res, interceptorResult, tme, ep, log);
144
- return;
139
+ if (!j.ignoreInterceptor) {
140
+ let interceptorResult;
141
+ if (this.options.interceptor) {
142
+ interceptorResult = await this.options.interceptor.execute(httpRequest);
143
+ if (interceptorResult.error) {
144
+ this.sendResponse(res, interceptorResult, tme, ep, log);
145
+ return;
146
+ }
147
+ httpRequest.interceptorResult = interceptorResult;
145
148
  }
146
- httpRequest.interceptorResult = interceptorResult;
147
149
  }
148
150
  result = await i.execute(httpRequest);
149
151
  }
@@ -8,6 +8,7 @@ export interface IBaseEndpoint {
8
8
  export interface IEndpointHandler {
9
9
  endpoint: string;
10
10
  handler: (req: HTTPRequestVO) => Promise<TransferPacketVO<any>>;
11
+ ignoreInterceptor?: boolean;
11
12
  }
12
13
  export declare class BaseEndpoint implements IBaseEndpoint {
13
14
  endpoints?: IEndpointHandler[];
@@ -50,7 +50,7 @@ class BaseEndpoint {
50
50
  async execute(req) {
51
51
  if (this.endpoints && this.endpoints.length > 0) {
52
52
  for (let i of this.endpoints) {
53
- if (i.endpoint === req.endpoint)
53
+ if (BaseEndpoint.entrypoint + i.endpoint === req.endpoint)
54
54
  return i.handler(req);
55
55
  }
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "1.2.9",
3
+ "version": "1.3.1",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",