lib/plezi/server/protocols/http_request.rb in plezi-0.7.5 vs lib/plezi/server/protocols/http_request.rb in plezi-0.7.6

- old
+ new

@@ -108,9 +108,17 @@ end # returns true of the method == PATCH def patch? self[:method] == 'PATCH' end + # returns true if the request is of type JSON. + def json? + self['content-type'].match /application\/json/ + end + # returns true if the request is of type XML. + def xml? + self['content-type'].match /text\/xml/ + end end end