Skip to content

Method not allowed -> Resource not found #124

@cgay

Description

@cgay

[On my v2 branch that should become the v2.0.0 release]

For the web60-static-routing example, the example works for all the full URLs like /users/foo/bar but if you access / you get Method not allowed: GET (405) error. I think this should be a 404 error, but it's not totally clear whether the example should be fixed or the server (i.e., the <resource> class) should be changed.

define constant $wiki-app = make(<resource>);
...
add-resource($wiki-app, "page/{action}/{title}/{version?}", make(<page>));
add-resource($wiki-app, "user/{action}/{name}", make(<user>));
add-resource($wiki-app, "group/{action}/{name}", make(<group>));
...
let server = make(<http-server>, host: "0.0.0.0", port: 8888);
add-resource(server, "/", $wiki-app);
start-server(server);

So there is a resource mapped to /, but the intention is clearly that this is just a parent resource. Since it's impossible for users to add behavior to a direct instance of <resource> I think we can give it a respond method that calls %resource-not-found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions