Skip to content

Commit

Permalink
Bump fast-xml-parser (#521)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
kiskoza and dependabot[bot] authored Aug 7, 2023
1 parent 3cdfa32 commit 28096cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
14 changes: 11 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"abab": "^2.0.3",
"debug": "^4.1.1",
"eventemitter3": "^4.0.0",
"fast-xml-parser": "^3.16.0",
"fast-xml-parser": "^4.2.4",
"file-type": "^10.11.0",
"follow-redirects": "^1.10.0",
"isutf8": "^2.1.0",
Expand Down
9 changes: 6 additions & 3 deletions src/lib/request/helpers/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { isURLSearchParams, isObject, isStream, isFormData, isArrayBuffer, isFil
import { getVersion, uniqueId } from './../../utils';
import { FsRequestOptions, FsResponse } from './../types';
import { set } from './headers';
import * as parser from 'fast-xml-parser';
import { XMLParser, XMLValidator } from 'fast-xml-parser';
import Debug from 'debug';

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

if (parser.validate(data) === true) {
response.data = parser.parse(data, {
if (XMLValidator.validate(data) === true) {
const parser = new XMLParser({
ignoreDeclaration: true,
ignoreAttributes : true,
trimValues: true,
});

response.data = parser.parse(data);
}
}

Expand Down

0 comments on commit 28096cf

Please sign in to comment.