You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After version 1.18.11 of urijs, an invalid port exception is thrown if the uri is constructed with a port that isn't valid. This check is useful to avoid having an invalid value as a port, increasing the correctness of the generated URI, but makes impossible to use the library when working with url templates.
Before 1.18.11, the following code snippet was possible:
consturi=newurijs('https://github.com:{port}');
After 1.18.11, the same code snippet throws the invalid port exception.
There're several possible solutions to this problem, in case there's the desire to support URI templates.
Make port check optional by passing an options object to the constructor:
The second idea that comes to my mind is to throw the exception not when the URI is created but when it's converted to a string. My hypothesis here is that uri.toString() or uri.valueOf() might be the last calls to the urijs library before the constructed URI is used.
consturi=newurijs('https://github.com:{port}');// valid, no exception is thrown// do stuff hereconstresp=awaitfetch(uri.toString());// here an exception will be thrown if the port is still invalid
There might be also other valid options.
Would such change be considered for this library?
The text was updated successfully, but these errors were encountered:
After version 1.18.11 of urijs, an invalid port exception is thrown if the uri is constructed with a port that isn't valid. This check is useful to avoid having an invalid value as a port, increasing the correctness of the generated URI, but makes impossible to use the library when working with url templates.
Before 1.18.11, the following code snippet was possible:
After 1.18.11, the same code snippet throws the invalid port exception.
There're several possible solutions to this problem, in case there's the desire to support URI templates.
options
object to the constructor:uri.toString()
oruri.valueOf()
might be the last calls to the urijs library before the constructed URI is used.Would such change be considered for this library?
The text was updated successfully, but these errors were encountered: