@anglr/rest
Version:
Angular module representing rest services
45 lines • 1.98 kB
TypeScript
import { HttpRequest, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { RestMiddleware } from '../interfaces';
import type { RESTClientBase } from '../misc/classes/restClientBase';
/**
* Middleware that is used for logging responses for mock usages
*
* @example
* Change providers for `REST_METHOD_MIDDLEWARES` that way, that you add `...jsDevMode ? [MockLoggerMiddleware] : []` to `REST_METHOD_MIDDLEWARES`
*
* For example
*
* ```ts
* <ValueProvider>
* {
* provide: REST_METHOD_MIDDLEWARES,
* useValue:
* [
* LoggerMiddleware,
* ResponseTypeMiddleware,
* ReportProgressMiddleware,
* ...jsDevMode ? [MockLoggerMiddleware] : [],
* ]
* },
* ```
*/
export declare class MockLoggerMiddleware implements RestMiddleware<unknown, unknown, unknown, unknown, HttpResponse<string | ArrayBuffer | Blob | object>> {
/**
* String identification of middleware
*/
static id: string;
/**
* Runs code that is defined for this rest middleware, in this method you can modify request and response
* @param this - Method is bound to RESTClient
* @param id - Unique id that identifies request method
* @param target - Prototype of class that are decorators applied to
* @param methodName - Name of method that is being modified
* @param descriptor - Descriptor of method that is being modified
* @param args - Array of arguments passed to called method
* @param request - Http request that you can modify
* @param next - Used for calling next middleware with modified request
*/
run(this: RESTClientBase, _id: string, _target: unknown, _methodName: string, _descriptor: unknown, _args: unknown[], request: HttpRequest<unknown>, next: (request: HttpRequest<unknown>) => Observable<HttpResponse<string | ArrayBuffer | Blob | object>>): Observable<unknown>;
}
//# sourceMappingURL=mockLogger.middleware.d.ts.map