From 87ec51260172f9e0e820c2a2572dc2b4635bc342 Mon Sep 17 00:00:00 2001 From: Katharina Keitel Date: Sun, 7 Jul 2024 18:53:45 +0200 Subject: [PATCH] linte-lib-xmlrpc fix --- projects/typescript-xmlrpc/src/lib/deserializer.ts | 3 --- .../src/lib/typescript-xmlrpc.service.ts | 14 +++++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/projects/typescript-xmlrpc/src/lib/deserializer.ts b/projects/typescript-xmlrpc/src/lib/deserializer.ts index d948d65d..27f0909e 100644 --- a/projects/typescript-xmlrpc/src/lib/deserializer.ts +++ b/projects/typescript-xmlrpc/src/lib/deserializer.ts @@ -77,7 +77,6 @@ function convertParams(element: Element): Array { } const params: Array = []; // Below ignore is due to: https://stackoverflow.com/a/22754453/4730773 - // eslint-disable-next-line @typescript-eslint/prefer-for-of for (let i = 0; i < methodResponseChildren.length; i++) { params.push(convertParam(methodResponseChildren[i])); } @@ -202,7 +201,6 @@ function convertArray(element: Element): XmlRpcArray { const result: XmlRpcArray = { data: []}; const dataChildren = arrayChildren[0].children; // Below ignore is due to: https://stackoverflow.com/a/22754453/4730773 - // eslint-disable-next-line @typescript-eslint/prefer-for-of for (let i = 0; i < dataChildren.length; i++) { result.data.push(convertValue(dataChildren[i])); } @@ -216,7 +214,6 @@ function convertStruct(element: Element): XmlRpcStruct { const collection = element.children; const result: Array = []; // Below ignore is due to: https://stackoverflow.com/a/22754453/4730773 - // eslint-disable-next-line @typescript-eslint/prefer-for-of for (let i = 0; i < collection.length; i++) { result.push(convertMember(collection[i])); } diff --git a/projects/typescript-xmlrpc/src/lib/typescript-xmlrpc.service.ts b/projects/typescript-xmlrpc/src/lib/typescript-xmlrpc.service.ts index 332f5db9..82a83ddd 100644 --- a/projects/typescript-xmlrpc/src/lib/typescript-xmlrpc.service.ts +++ b/projects/typescript-xmlrpc/src/lib/typescript-xmlrpc.service.ts @@ -7,19 +7,23 @@ import { deserialize } from './deserializer'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; + +const BODY = 'body'; +const TEXT = 'text'; + @Injectable({ providedIn: 'root' }) export class AngularXmlrpcService { private readonly http: HttpClient; private url: URL; - private headers: any; + private headers: object; - static instanceOfMethodResponse(object: any): object is MethodResponse { + static instanceOfMethodResponse(object: object): object is MethodResponse { return 'value' in object; } - static instanceOfMethodFault(object: any): object is MethodFault { + static instanceOfMethodFault(object: object): object is MethodFault { return 'faultCode' in object && 'faultString' in object; } @@ -61,8 +65,8 @@ export class AngularXmlrpcService { const options: object = { headers: httpOptions, reportProgress: false, - observe: 'body' as 'body', - responseType: 'text' as 'text', + observe: BODY, + responseType: TEXT, withCredentials: false };