Skip to content

Commit

Permalink
fix(#821): handle dom parser exception for invalid xml
Browse files Browse the repository at this point in the history
  • Loading branch information
AnWeber committed Nov 1, 2024
1 parent 7339667 commit c34481c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [unreleased]

### Fix
- handle dom parser exception for invalid xml (#821)


## [6.16.3] (2024-10-30)

### Fix
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/xml/xmlResponseInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export const xmlResponseInterceptor = {
utils.isString(response.body) &&
response.body.length > 0
) {
const document = parseFromString(
response.body,
utils.isMimeTypeHtml(response.contentType) ? 'text/html' : 'text/xml'
);
response.parsedBody = document;
try {
const document = parseFromString(
response.body,
utils.isMimeTypeHtml(response.contentType) ? 'text/html' : 'text/xml'
);
response.parsedBody = document;
response.prettyPrintBody = formatXml(document, {
eol: EOL,
indentation: ' ',
Expand Down

0 comments on commit c34481c

Please sign in to comment.