Sha256: 28a2fa8e70cab651eef05323deb600e6ac0885adf740657d5fdadc89dbc51193

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

require "spec_helper"

describe Rack::API, "Headers" do
   before do
    Rack::API.app do
      version :v1 do
        get("/users(.:format)") do
          headers["X-Awesome"] = "U R Awesome"
          headers["Content-Type"] = "application/x-json"
        end
      end
    end
  end

  it "sends custom headers" do
    get "/v1/users"
    last_response.headers["X-Awesome"].should == "U R Awesome"
  end

  it "overrides inferred content type" do
    get "/v1/users.json"
    last_response.headers["Content-Type"].should == "application/x-json"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-api-0.1.2 spec/rack-api/headers_spec.rb
rack-api-0.1.1 spec/rack-api/headers_spec.rb
rack-api-0.1.0 spec/rack-api/headers_spec.rb