core: download metadata with JSON accept header
This commit is contained in:
parent
2dac667544
commit
d4c753c48d
|
@ -134,7 +134,7 @@ module Vagrant
|
|||
|
||||
metadata = nil
|
||||
begin
|
||||
metadata_path = download(url, env, ui: false)
|
||||
metadata_path = download(url, env, json: true, ui: false)
|
||||
|
||||
File.open(metadata_path) do |f|
|
||||
metadata = BoxMetadata.new(f)
|
||||
|
@ -391,6 +391,7 @@ module Vagrant
|
|||
downloader_options[:continue] = true
|
||||
downloader_options[:insecure] = env[:box_download_insecure]
|
||||
downloader_options[:client_cert] = env[:box_client_cert]
|
||||
downloader_options[:headers] = ["Accept: application/json"] if opts[:json]
|
||||
downloader_options[:ui] = env[:ui] if opts[:ui]
|
||||
|
||||
Util::Downloader.new(url, temp_path, downloader_options)
|
||||
|
|
|
@ -26,6 +26,7 @@ module Vagrant
|
|||
options ||= {}
|
||||
@ca_cert = options[:ca_cert]
|
||||
@continue = options[:continue]
|
||||
@headers = options[:headers]
|
||||
@insecure = options[:insecure]
|
||||
@ui = options[:ui]
|
||||
@client_cert = options[:client_cert]
|
||||
|
@ -180,6 +181,12 @@ module Vagrant
|
|||
options << "--insecure" if @insecure
|
||||
options << "--cert" << @client_cert if @client_cert
|
||||
|
||||
if @headers
|
||||
Array(@headers).each do |header|
|
||||
options << "-H" << header
|
||||
end
|
||||
end
|
||||
|
||||
# Specify some options for the subprocess
|
||||
subprocess_options = {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue