-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Milestone
Description
I think this is a bug in the reverse lookup with "/". If I change the binding to {action: "/someAction" } it works as expected.
var {Application} = require("stick");
var {redirectTo} = require("stick/helpers");
var log = require("ringo/logging").getLogger(module.id);
var fs = require("fs");
var app = exports.app = Application();
var response = require("ringo/jsgi/response");
app.configure("params", "upload", "route");
app.post("/uploadImage", function(req) {
if (req.postParams.formFileInput && req.postParams.formFileInput.value.length > 0) {
fs.write(module.resolve("files/" + req.postParams.formFileInput.filename), req.postParams.formFileInput.value);
// This redirects to http://localhost:8080/upload/_/_(unknown_route)
return redirectTo(app, {
action: "/" // <----- FAILS with: Error: Unhandled request (stick/lib/stick.js#193)
});
}
return response.html("<html><body><h1>Upload failed.</h1></body></html>");
});
app.get("/", function(req) {
return response.html("<html><head><title>File Upload Demo</title></head> \
<body><form method='POST' action='uploadImage' enctype='multipart/form-data'> \
<h1>Upload:</h1> \
<input type='file' name='formFileInput' /><hr/><input type='submit' value='Upload' /> \
</form></body> \
</html>");
});Metadata
Metadata
Assignees
Labels
No labels