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
Validate url #1186
Validate url #1186
Conversation
…ap with the link component or just leave as it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small comment 😄
@@ -0,0 +1,13 @@ | |||
const { URL } = require('url'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function isn't doing very much and is not used anywhere else, I recommend just adding it as a method on the ResponseHeadersViewer
component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, will work it and update you ASAP.
Hey Greg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
Congrats on merging your first pull request! 🎉🎉🎉 You're helping make Insomnia awesome! 🙌 |
* place validateURL module in insomnia-url package * import validataeURL module and add it to the exports * import validateURL and pass h.value to the function, if its a url, wrap with the link component or just leave as it is * remove validateURL module from insomnia-url package * delete import statment that imports validateURL module * place validateURL function inside reponse-header-viewer * require URL api from url module
Closes #1050
Used NodeJs's URL module, the module provides a class that is implemented by following WHATWG's URL Standard (Link to the documentation)
When a string is passed as an argument to the constructor, if the stirng is a valid URL, it returns an object, that contains parsed URL (see example below). If the given string is not a valid URL string, then it throws an error stating the given string is an invalid URL.
Example for the value returned by WHATWG's URL API:
Implementation details of making valid URL clickable in the response header
Implementation details of the validateURL module