Skip to content

Commit 28096cf

Browse files
Bump fast-xml-parser (#521)
* build(deps): bump fast-xml-parser from 3.16.0 to 4.2.4 Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 3.16.0 to 4.2.4. - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/commits) --- updated-dependencies: - dependency-name: fast-xml-parser dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Fix code after fast-xml-parser version bump --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 3cdfa32 commit 28096cf

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

package-lock.json

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"abab": "^2.0.3",
4646
"debug": "^4.1.1",
4747
"eventemitter3": "^4.0.0",
48-
"fast-xml-parser": "^3.16.0",
48+
"fast-xml-parser": "^4.2.4",
4949
"file-type": "^10.11.0",
5050
"follow-redirects": "^1.10.0",
5151
"isutf8": "^2.1.0",

src/lib/request/helpers/data.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { isURLSearchParams, isObject, isStream, isFormData, isArrayBuffer, isFil
1818
import { getVersion, uniqueId } from './../../utils';
1919
import { FsRequestOptions, FsResponse } from './../types';
2020
import { set } from './headers';
21-
import * as parser from 'fast-xml-parser';
21+
import { XMLParser, XMLValidator } from 'fast-xml-parser';
2222
import Debug from 'debug';
2323

2424
const debug = Debug('fs:request:data');
@@ -99,11 +99,14 @@ export const parseResponse = async (response: FsResponse): Promise<FsResponse> =
9999
data = bufferToString(response.data);
100100
}
101101

102-
if (parser.validate(data) === true) {
103-
response.data = parser.parse(data, {
102+
if (XMLValidator.validate(data) === true) {
103+
const parser = new XMLParser({
104+
ignoreDeclaration: true,
104105
ignoreAttributes : true,
105106
trimValues: true,
106107
});
108+
109+
response.data = parser.parse(data);
107110
}
108111
}
109112

0 commit comments

Comments
 (0)