<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -55,6 +55,10 @@ module Rack #:nodoc:
       @env['HTTP_USER_AGENT']
     end
 
+    def accept
+      @env['HTTP_ACCEPT'].split(',').map { |a| a.strip }
+    end
+
     private
 
       # Return truthfully if and only if the following conditions are met: 1.) the
@@ -174,6 +178,9 @@ module Sinatra
       if host = options[:host] 
         return unless host === request.host
       end
+      if accept = options[:accept]
+        return unless request.accept.include? accept
+      end
       return unless pattern =~ request.path_info.squeeze('/')
       params.merge!(param_keys.zip($~.captures.map(&amp;:from_param)).to_hash)
       splats = params.select { |k, v| k =~ /^_splat_\d+$/ }.sort.map(&amp;:last)</diff>
      <filename>lib/sinatra.rb</filename>
    </modified>
    <modified>
      <diff>@@ -191,6 +191,21 @@ context &quot;Events in an app&quot; do
 
   end
 
+  specify &quot;filters by accept header&quot; do
+
+    get '/', :accept =&gt; 'image/jpg' do
+      request.env['HTTP_ACCEPT']
+    end
+
+    get_it '/', :env =&gt; { :accept =&gt; 'image/jpg' }
+    should.be.ok
+    body.should.equal 'image/jpg'
+
+    get_it '/', :env =&gt; { :accept =&gt; 'text/html' }
+    should.not.be.ok
+
+  end
+
   specify &quot;can use regex to get parts of user-agent&quot; do
     
     get '/', :agent =&gt; /Windows (NT)/ do</diff>
      <filename>test/application_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ea3239c88f8a85f82cc891589bc6ad1c339719e8</id>
    </parent>
  </parents>
  <author>
    <name>Adam Wiggins</name>
    <email>adam@heroku.com</email>
  </author>
  <url>http://github.com/adamwiggins/sinatra/commit/9c413351c79f35a72f93cf74f3f516cab3bda4e5</url>
  <id>9c413351c79f35a72f93cf74f3f516cab3bda4e5</id>
  <committed-date>2008-06-08T02:17:17-07:00</committed-date>
  <authored-date>2008-06-08T02:17:17-07:00</authored-date>
  <message>:accept option to filter on HTTP accept header</message>
  <tree>4814239e11aeea44a02f6d0acb0f028b0c25120c</tree>
  <committer>
    <name>Adam Wiggins</name>
    <email>adam@heroku.com</email>
  </committer>
</commit>
