joaotavora / snooze

Common Lisp RESTful web development
207 stars 22 forks source link

Problems using the DELETE verb #11

Closed lucashpandolfo closed 6 years ago

lucashpandolfo commented 6 years ago

Hi. I'm having problems while using the DELETE method:

(defroute something (:delete ignored-type id)
      (do-something))

Does define a DELETE handler for the resource (or something), but I couldn't make the handler work. I mean, when requesting a DELETE method for the resource, I always get a Not such route error.

Examining the code I notice that matching-content-type-or-lose has nothing to work with, as handle-request-1 fills the last parameter (content-types-to-try) based on the type of verb used. It has a case for sending-verbs and another for receiving-verbs, but in this case DELETE is a plain http-verb, so the list came out empty, so in the end matching-content-type-or-losethrows a 501. At least that's what I think it's happening.

Now the real question: Is this a bug or am I doing something really stupid?

Thanks for your work. Cheers.

joaotavora commented 6 years ago

Now the real question: Is this a bug or am I doing something really stupid?

Seems like either a bug or insufficiently clear instructions at least. I'm away from my computer right now, but i will have a look asap. Thanks for showing an interest in snooze.

joaotavora commented 6 years ago

This was a bug (a big one thanks). I had never actually tested DELETE, only in theory. Now there's an automated test in place. Please re-check in your application.