Ticket #144 (closed defect: fixed)
[PATCH] If we don't support we don't
| Reported by: | julik | Owned by: | zimbatm |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | camping.rb | Version: | |
| Keywords: | Cc: |
Description
Camping should give a meaningful response when there is no method to catch the request. This is also most essential to Mosquito and other testing purposes. It's also much more RESTful.
Index: /Code/camping-trunk/lib/camping-unabridged.rb
===================================================================
--- /Code/camping-trunk/lib/camping-unabridged.rb (revision 224)
+++ /Code/camping-trunk/lib/camping-unabridged.rb (working copy)
@@ -406,7 +406,7 @@
# See http://code.whytheluckystiff.net/camping/wiki/BeforeAndAfterOverrides for more
# on before and after overrides with Camping.
def service(*a)
- @body = send(@method, *a) if respond_to? @method
+ @body = respond_to?(@method) ? send(@method, *a) : (@status = 405; '')
headers['Set-Cookie'] = cookies.map { |k,v| "#{k}=#{C.escape(v)}; path=#{self/"/"}" if v != @k[k] } - [nil]
self
end
Change History
Note: See
TracTickets for help on using
tickets.
