Skip to content

Commit

Permalink
fix: switch from xml2js to fast-xml-parser
Browse files Browse the repository at this point in the history
  • Loading branch information
npenin committed Mar 23, 2024
1 parent 540a441 commit 0abd31b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
"chokidar": "^3.5.3",
"co-body": "^6.1.0",
"cookie": "^0.6.0",
"fast-xml-parser": "^4.3.6",
"hasown": "^2.0.0",
"mime-types": "^2.1.35",
"on-finished": "^2.4.1",
"reflect-metadata": "^0.2.0",
"require-optional": "^0.4.0",
"send": "^0.18.0",
"source-map-support": "^0.5.21",
"xml2js": "^0.6.2"
"source-map-support": "^0.5.21"
},
"commands": "./commands.json",
"gitHead": "d92f6693ed8cca439c8e92d2045bb15c0a7dae43",
Expand Down
13 changes: 2 additions & 11 deletions packages/server/src/http.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { FetchHttp, Http as coreHttp } from '@akala/core';
import * as xml2js from 'xml2js'
import xml from 'fast-xml-parser'

FetchHttp.prototype['getXML'] = function (this: FetchHttp, url: string)
{
return this.call({ url: url, method: 'get' }).then(r => r.text().then(text =>
{
return new Promise((resolve, reject) =>
{
xml2js.parseString(text, { async: true }, function (err, result)
{
if (err)
reject(err);
else
resolve(result);
});
})
return new xml.XMLParser().parse(text);
}))
}

Expand Down

0 comments on commit 0abd31b

Please sign in to comment.