Sha256: ba04b8183f7959f7e1edea932a11708ed3137a1c8c66d41b9e62fd3f0441d10b

Contents?: true

Size: 870 Bytes

Versions: 4

Compression:

Stored size: 870 Bytes

Contents

RSpec.describe Faraday::Conductivity::RequestHeaders do

  it "includes the mimetype specified" do
    connection = create_connection do |faraday|
      faraday.request :request_headers, :accept => "application/json", :x_version_number => "123"
    end
    request_headers = connection.get("/test").env[:request_headers]

    expect(request_headers["Accept"]).to eq "application/json"
    expect(request_headers["X-Version-Number"]).to eq "123"
  end

  it "doesn't override locally specified headers" do
    connection = create_connection do |faraday|
      faraday.request :request_headers, :accept => "application/json"
    end
    response = connection.get("/test") do |request|
      request.headers[:accept] = "application/xml"
    end

    request_headers = response.env[:request_headers]

    expect(request_headers["Accept"]).to eq "application/xml"
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
faraday-conductivity-2.0.0 spec/middleware/request_headers_spec.rb
faraday-conductivity-1.0.1 spec/middleware/request_headers_spec.rb
faraday-conductivity-1.0.0 spec/middleware/request_headers_spec.rb
faraday-conductivity-0.3.1 spec/middleware/request_headers_spec.rb