-
-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
I'm trying to create a REST api. I already had the GET method, but when I added the post method on the same route ("/") it disables the previous defined GET. Same goes if I first define the POST and then the GET method, only the last one define stays.
http_api my_api;
my_api.get("/") = [&](li::http_request& request, li::http_response& response) {
throw li::http_error::unauthorized("You cannot access this route.");
};
my_api.post("/") = [&](li::http_request& request, li::http_response& response) {
throw li::http_error::unauthorized("You cannot access this route.");
};
# this works
curl --header "Content-Type: application/json" \
--request POST \
--data '{ "age": 2}' \
localhost:3000
You cannot access this route.
# this does not
curl -vXGET localhost:3000
Method GET not implemented on route /
Is there any way to make this work?
Metadata
Metadata
Assignees
Labels
No labels