feature - added operator - ofType
MODIFY
src/http.interface.ts
src/http.interface.ts
@@ -9,6 +9,8 @@ export interface HttpResponse extends http.ServerResponse {}
export type HttpHeaders = Record<string, string>;
+export type HttpMethod = 'POST' | 'PUT' | 'PATCH' | 'GET' | 'HEAD' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE';
+
export type Http = {
req: HttpRequest,
res: HttpResponse,

ADD
src/operators/ofType.operator.ts
+import { Observable } from 'rxjs';
+import { filter } from 'rxjs/operators';
+import { HttpMethod, HttpRequest } from '../http.interface';
+
+export const ofType = (httpMethodType: HttpMethod) => (source$: Observable<HttpRequest>) =>
+ source$.pipe(
+ filter(req => req.method === httpMethodType)
+ );

feature - added operator - ofType