You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a REST API with SQLPage. I noticed a problem with the use of the DELETE verb. If I do not put a / character at the end of the URL, I get a 301 Moved Permanently error. I do not have this issue with the other HTTP verbs (GET, PUT, POST, PATCH).
The following code is in the file /api/v1/users/404.sql.
SELECT'json'AS component;
SELECT
CASE sqlpage.request_method()
WHEN 'GET' THEN 'READ'
WHEN 'DELETE' THEN 'REMOVE'
END AS value;
You can reproduce the problem with these examples.
GET http://localhost:8080/api/v1/users
###
# Error 301 Moved Permanently ?
DELETE http://localhost:8080/api/v1/users/42
###
# works fine !
DELETE http://localhost:8080/api/v1/users/42/