Parcourir la source

fix: json2xmlparser not working at all?

Sv443 il y a 2 ans
Parent
commit
ed95d7371d
1 fichiers modifiés avec 2 ajouts et 8 suppressions
  1. 2 8
      src/utils.ts

+ 2 - 8
src/utils.ts

@@ -1,6 +1,6 @@
 import { Response } from "express";
 import { Response } from "express";
 import { Stringifiable } from "svcorelib";
 import { Stringifiable } from "svcorelib";
-import jsonToXml from "js2xmlparser";
+import { parse as jsonToXml } from "js2xmlparser";
 import { ResponseType } from "./types";
 import { ResponseType } from "./types";
 
 
 /** Checks if the value of a passed URL parameter is valid */
 /** Checks if the value of a passed URL parameter is valid */
@@ -65,14 +65,8 @@ export function respond(res: Response, type: ResponseType | number, data: String
         timestamp: Date.now(),
         timestamp: Date.now(),
     };
     };
 
 
-    const finalData = format === "xml" ? jsonToXml.parse("data", resData) : resData;
+    const finalData = format === "xml" ? jsonToXml("data", resData) : resData;
 
 
     res.setHeader("Content-Type", format === "xml" ? "application/xml" : "application/json");
     res.setHeader("Content-Type", format === "xml" ? "application/xml" : "application/json");
     res.status(statusCode).send(finalData);
     res.status(statusCode).send(finalData);
 }
 }
-
-export function getAxiosAuthConfig(authToken?: string) {
-    return authToken ? {
-        headers: { "Authorization": `Bearer ${authToken}` },
-    } : {};
-}