Class: Supermarket::Api
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Supermarket::Api
- Includes:
- Rack::RespondTo
- Defined in:
- lib/supermarket/api.rb
Instance Method Summary collapse
-
#respond_to ⇒ Object
get(“/:id/image”) do content_type :jpeg.
Instance Method Details
#respond_to ⇒ Object
get(“/:id/image”) do
content_type :jpeg
session = Session.new
session.image_data(params[:id])
end
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/supermarket/api.rb', line 48 def respond_to env['HTTP_ACCEPT'] ||= 'text/html' Rack::RespondTo.env = env super { |format| yield(format).tap do |response| type = Rack::RespondTo::Helpers.match(Rack::RespondTo.media_types, format).first content_type(type) if type end } end |