Thanks for this nifty little library.
I am testing out the server and I noticed that the methods advertised in the response do not match the route definition, e.g.
local mote = require "mote"
mote.get("/heartbeat", function(ctx)
ctx.response.status = 200
ctx.response.body = { message = "I am alive!" }
end)
local app = mote.create({ port = 5000 })
app:run()
Sending a request:
$ curl -iXPUT localhost:5000/heartbeat
HTTP/1.1 404 Not Found
Content-Type: application/json
Keep-Alive: timeout=5, max=1000
Connection: keep-alive
Content-Length: 21
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
{"error":"not found"}
In this case I would expect the Access-Control-Allow-Methods to be set to GET (and HEAD if you want to stick with RFC 7231 and the response for PUT should be HTTP 405.
Good to see that HEAD works correctly (at least with curl).
Thanks for this nifty little library.
I am testing out the server and I noticed that the methods advertised in the response do not match the route definition, e.g.
Sending a request:
In this case I would expect the
Access-Control-Allow-Methodsto be set toGET(andHEADif you want to stick with RFC 7231 and the response forPUTshould be HTTP 405.Good to see that HEAD works correctly (at least with curl).