gitlab-org--gitlab-foss/lib/api/helpers/headers_helpers.rb
gfyoung 3836d69119 Enable frozen string in lib/api and lib/backup
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
2018-09-29 21:04:50 -07:00

17 lines
424 B
Ruby

# frozen_string_literal: true
module API
module Helpers
module HeadersHelpers
def set_http_headers(header_data)
header_data.each do |key, value|
if value.is_a?(Enumerable)
raise ArgumentError.new("Header value should be a string")
end
header "X-Gitlab-#{key.to_s.split('_').collect(&:capitalize).join('-')}", value.to_s
end
end
end
end
end