Sha256: 27285ca7da1a6bef8a9e7fdff6f7a7625191fa79e8927b9df1f8c753611b789e

Contents?: true

Size: 431 Bytes

Versions: 2

Compression:

Stored size: 431 Bytes

Contents

module VersionCake
  module ResponseStrategy
    class HttpContentTypeStrategy < Base
      def execute(context, _status, headers, _response)
        return if headers['Content-Type'].nil?

        content_type = headers['Content-Type']
        content_type << ';' unless headers['Content-Type'].end_with?(';')

        headers['Content-Type'] = "#{content_type} #{version_key}=#{context.version.to_s}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
versioncake-4.1.1 lib/versioncake/response_strategy/http_content_type_strategy.rb
versioncake-4.1.0 lib/versioncake/response_strategy/http_content_type_strategy.rb