jacomyal/domino.js

[reboot-proposal] Services with port seem to be broken

Closed this issue · 3 comments

[reboot-proposal] Services with port seem to be broken

Your test case is something like: http://:host:8000/some/api/route, with :host to solve, but not :8000.
It might come from the fact that some matching part of the URL does not resolve (the port) it might also come from the fact that you have two substring that match the /:([^\/]*)/g regexp next to each other.
I'll investigate.

Error n°1:
In this code, since I replace the matching part of the URL by the related value, I should also update the lastIndex value. So, if you have something like :toSolve1/:toSolve2 with toSolve1 getting replaced by a too short string such as "a", the lastIndex will be too high and the second string :toSolve2 will not be found by the regexp.

Error n°2:
The RegExp is wrong. It is /:([^\/]*)/g but should be /:([^\/:]*)/g. So, basically, in your case, it finds the string :host:8000 and cannot solve it. It will be fixed in the afternoon.

Waiting for this, you can already simply set domino.settings.paramSolver = /:([^\/:]*)/g;.