Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML pretty pretty printing causes extension to raise exceptions #821

Open
NonLogicalDev opened this issue Oct 31, 2024 · 1 comment
Open

Comments

@NonLogicalDev
Copy link

NonLogicalDev commented Oct 31, 2024

I was running HttpYak agains a basic local server that was outputting sample HTML/JSON data and noticed that

  • mismatching ContentType like text/html for JSON would cause the extension to raise exception
  • DocTypes like <!doctype html /> also cause exceptions as pretty printer does not like it

I think both issues are due to the XML parser trowing exceptions:

6.16.0...6.16.1#diff-7f25891c1de6aa3847cf8cb9c1bbf5b6f7e512662b18a71d5a236061a9ed140dR23-R26

        const document = parseFromString(
          response.body,
          utils.isMimeTypeHtml(response.contentType) ? 'text/html' : 'text/xml'
        );

Sample Stack Trace:

EG: Not well-formed XML starting with "<!" at position 0 at JI.fatalError (/Users/<USER>/.vscode/extensions/anweber.vscode-httpyac-6.16.3/dist/extension.js:157:3567) at LPe (/Users/<USER>/.vscode/extensions/anweber.vscode-httpyac-6.16.3/dist/extension.js:155:3388) at nHt (/Users/<USER>/.vscode/extensions/anweber.vscode-httpyac-6.16.3/dist/extension.js:154:20087) at MPe.parse (/Users/<USER>/.vscode/extensions/anweber.vscode-httpyac-6.16.3/dist/extension.js:154:17785) at KPe.parseFromString (/Users/<USER>/.vscode/extensions/anweber.vscode-httpyac-6.16.3/dist/extension.js:157:1165) at rJ (/Users/<USER>/.vscode/extensions/anweber.vscode-httpyac-6.16.3/dist/extension.js:280:28801) at Object.beforeLoop (/Users/<USER>/.vscode/extensions/anweber.vscode-httpyac-6.16.3/dist/extension.js:280:29556) at Wte.intercept (/Users/<USER>/.vscode/extensions/anweber.vscode-httpyac-6.16.3/dist/extension.js:27:3784) at processTicksAndRejecti...

Platform: MacOS
Version: 6.16.3

@AnWeber
Copy link
Owner

AnWeber commented Oct 31, 2024

That's right. It's bad when you can only nod when someone explains a bug. I will fix it. It came in due to the changed behavior of xmldom. I noticed it, but didn't think about it any further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants