Sha256: eff468d207232a9f14c33109e8a836d11dca5a481c0ddc547ac38c1838f84159

Contents?: true

Size: 776 Bytes

Versions: 53

Compression:

Stored size: 776 Bytes

Contents

require "spec_helper"

describe Pliny::Middleware::RequestID do
  def app
    Rack::Builder.new do
      use Rack::Lint
      use Pliny::Middleware::RequestID
      run Sinatra.new {
        get "/" do
          env["REQUEST_IDS"].join(",")
        end
      }
    end
  end

  it "tags responses with Request-Id" do
    get "/"
    assert_match Pliny::Middleware::RequestID::UUID_PATTERN,
      last_response.headers["Request-Id"]
  end

  it "accepts incoming request IDs" do
    id = SecureRandom.uuid
    header "Request-Id", id
    get "/"
    assert_includes last_response.body, id
  end

  it "accepts incoming request IDs with an `X-` prefix" do
    id = SecureRandom.uuid
    header "X-Request-Id", id
    get "/"
    assert_includes last_response.body, id
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
pliny-1.1.0 spec/middleware/request_id_spec.rb
pliny-1.0.0 spec/middleware/request_id_spec.rb
pliny-0.32.0 spec/middleware/request_id_spec.rb
pliny-0.31.0 spec/middleware/request_id_spec.rb
pliny-0.30.1 spec/middleware/request_id_spec.rb
pliny-0.30.0 spec/middleware/request_id_spec.rb
pliny-0.29.0 spec/middleware/request_id_spec.rb
pliny-0.28.0 spec/middleware/request_id_spec.rb
pliny-0.27.1 spec/middleware/request_id_spec.rb
pliny-0.27.0 spec/middleware/request_id_spec.rb
pliny-0.26.2 spec/middleware/request_id_spec.rb
pliny-0.26.1 spec/middleware/request_id_spec.rb
pliny-0.26.0 spec/middleware/request_id_spec.rb
pliny-0.25.1 spec/middleware/request_id_spec.rb
pliny-0.25.0 spec/middleware/request_id_spec.rb
pliny-0.24.0 spec/middleware/request_id_spec.rb
pliny-0.23.0 spec/middleware/request_id_spec.rb
pliny-0.22.0 spec/middleware/request_id_spec.rb
pliny-0.21.0 spec/middleware/request_id_spec.rb
pliny-0.20.2 spec/middleware/request_id_spec.rb