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
.get does not identify valid route request after it returned correct response #1581
Comments
Thanks for the bug report, this definitely seems problematic. Will try to take a look later this week. |
Thank you. Please let me know if I can help you with something. |
@DonutEspresso tl;dr: It's probably due to having/using the Longer Version:I wrote a small service which basically acts as a "key-value" database. You can put anything, and if you call the same route, it returns the data you have putted. So I did
Although, I have a Now to the exciting part: matchUrl reuses the regexp passed to
Remember, Now, my first The second But that also means, that if the "shorter" route is called first, the Possible things to do:My fix was to simply remove the However, to safe other people from that, I would probably suggest adding some documentation to warn of |
@Junkern did you found the code in node-restify where the regular expression changes? I d Like to use this in production but it is blocked by this issue. 😢 |
An update on this issue: We are in the process of moving to a new router, find-my-way. This is a breaking change that will change the supported routing semantics, but it looks like the new semantics will fit your use case much better! Open PR: #1561 |
Now that Restify 7.x is release could you please check your use case with it? |
There is a reproducable example in this issue . We have this on storyboard
in a few weeks. Still looking for a solution. We will take a look. May take
some time if it needs migration.
Am 10.04.2018 20:20 schrieb "Peter Marton" <notifications@github.com>:
Now that Restify 7.x is release could you please check your use case with
it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1581 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABNjhr-B7nXwcAru8e21KiS1xFb6y000ks5tnPf0gaJpZM4Q5sZs>
.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@s-a just to close the loop here - the API has changed a bit in 7.x so your repro case doesn't work out of the box anymore. I tried to take a stab at it locally but seeing as the new router doesn't support free from regex's anymore I think we may need to take a different approach. The new versioning changes can be found here: Take a look and let us know! |
Sorry for the delay friends. We migrated to latest |
Bug Report
Serving static data with plugin
restify.plugins.serveStatic
alternating returns405
Restify Version
6.3.4
Node.js Version
v8.9.0
Expected behaviour
Static resource request should be served with status
200
Actual behaviour
Sometimes static resource request will be served with status
405
Repro case
git clone https://github.com/s-a/restify-routes-start.git
cd restify-routes-start
npm install
npm start
This example request a static
JSON
file 3 times. In this case 2 of them returns with405
Update:
I tried to take a look at the code but cannot identify what is going wrong here. The wrong exit point for my requests is here /lib/router.js#L581. Hard to understand because there are so many exit points in
Router.prototype.find
but if I understand correct the program should not reach this code area. So I think the main error occurs before matchURL wherere
parameter changes while runtime.re.exec
fails with/\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\/?.*\b/gi
re.exec
succeed with/\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\/?.*\b/
which is the original regular expression i passed to.get
function.The text was updated successfully, but these errors were encountered: