-
Notifications
You must be signed in to change notification settings - Fork 119
feat: add xml content type custom validation #158
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
base: main
Are you sure you want to change the base?
Conversation
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Great work! Thanks for digging into that, this'll be really useful. I've done a quick test, and it seems super fast even with quite large XML documents, so I'm not too worried about debouncing. Most very large documents will be in intercepted traffic anyway - where they're generally readonly. The 10-character line isn't great though I think... I've opened an issue on fast-xml-parser (NaturalIntelligence/fast-xml-parser#753) to see if they're interested in adding end column info to validation results in future (I don't think any significant compute work should be required most of the time - in lots of cases it's known from an existing regex match etc - it just that it needs exposing) but we'll have to work without that for now. I think the best option might be to just highlight from the start column to the end of the line. That's not perfect, but I think will work perfectly in most cases, since we automatically prettify XML when you view intercepted traffic (so there's usually one tag per line anyway). People entering their own XML on the Send page will probably use whitespace, so this will cover the right code automatically. In any scenarios where it is wrong, at least it will start in the right place so it's still easy to see where the problem comes from. That seems better than an arbitrary magic length to me, what do you think? There are some small issues here with setting/unsetting the validation though. I've done some testing and:
These are probably related. I forget exactly how the Monaco model lifecycle stuff works in depth, but we do need to make sure that this works nicely with state transitions like these. |
Thanks for opening the suggestion issue on the library, it didn't come to my mind. |
Closes httptoolkit/httptoolkit#94
Things to consider: