Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Just read this in the REST API Rulebook: GET and POST must not be used to tunnel other request methods.

Tunneling refers to any abuse of HTTP that masks or misrepresents a message’s intent and undermines the protocol’s transparency. A REST API must not compromise its design by misusing HTTP’s request methods in an effort to accommodate clients with limited HTTP vocabulary. Always make proper use of the HTTP methods as specified by the rules in this section. [highlights by me]

But then a lot of frameworks use tunneling to expose REST interfaces via HTML forms, since <form> knows only about GET and POST. My most recent example is a MethodRewriteMiddleware for flask (submitted by the author of the framework): http://flask.pocoo.org/snippets/38/.

Any ways to comply to the "Rule" without hacks or add-ons in web frameworks?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

No, there isn't. So if you need to, break the rule anyway.

I don't know what the big deal is. Protocols encapsulate other protocols all the time. TC/PIP has four layers of such abstraction.

Of course, the better path is for clients to get with the program and support the HTTP verbs properly. But it's not a perfect world.

share|improve this answer
    
Thanks, well everybody is doing it anyway (and other protocols do it by design, as you mention it). I just was a bit surprised to find the "rule" written down so clearly. –  miku Oct 25 '12 at 21:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.