AnWeber / httpyac

Command Line Interface for *.http and *.rest files. Connect with http, gRPC, WebSocket and MQTT
https://httpyac.github.io/
MIT License
426 stars 38 forks source link

XML pretty pretty printing causes extension to raise exceptions #821

Open NonLogicalDev opened 2 weeks ago

NonLogicalDev commented 2 weeks ago

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

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

https://github.com/AnWeber/httpyac/compare/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 commented 2 weeks ago

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