Prevent trailing space character on user agent

This commit is contained in:
Chris Roberts 2022-09-28 13:51:54 -07:00
parent e0646e773f
commit c7ef689d86
2 changed files with 7 additions and 1 deletions

View File

@ -21,7 +21,7 @@ module Vagrant
# are properly tracked.
#
# Vagrant/1.7.4 (+https://www.vagrantup.com; ruby2.1.0)
USER_AGENT = "Vagrant/#{VERSION} (+https://www.vagrantup.com; #{RUBY_ENGINE}#{RUBY_VERSION}) #{ENV['VAGRANT_USER_AGENT_PROVISIONAL_STRING']}".freeze
USER_AGENT = "Vagrant/#{VERSION} (+https://www.vagrantup.com; #{RUBY_ENGINE}#{RUBY_VERSION}) #{ENV['VAGRANT_USER_AGENT_PROVISIONAL_STRING']}".strip.freeze
# Hosts that do not require notification on redirect
SILENCED_HOSTS = [

View File

@ -22,6 +22,12 @@ describe Vagrant::Util::Downloader do
allow(Vagrant).to receive(:in_installer?).and_return(false)
end
describe "USER_AGENT" do
it "should not include a trailing space" do
expect(described_class.const_get(:USER_AGENT)).not_to end_with(" ")
end
end
describe "#download!" do
let(:curl_options) {
["-q", "--fail", "--location", "--max-redirs", "10",