0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-03-25 02:32:52 -05:00

should add via header for all requests

This commit is contained in:
Alex Kocharin 2015-03-28 22:20:54 +03:00
parent 8a3a03805e
commit 554d31d119
2 changed files with 6 additions and 4 deletions

View file

@ -385,9 +385,10 @@ Storage.prototype.search = function(startkey, options, callback) {
return merge_with_local_packages(null, null, {})
}
self.uplinks[uplinks[i]].request({
uri: options.req.url,
timeout: self.uplinks[p].timeout,
json: true,
uri : options.req.url,
timeout : self.uplinks[p].timeout,
json : true,
req : options.req,
}, function(err, res, body) {
if (err || Math.floor(res.statusCode / 100) > 3) {
i++

View file

@ -111,6 +111,7 @@ Storage.prototype.request = function(options, cb) {
headers['Accept'] = headers['Accept'] || 'application/json'
headers['Accept-Encoding'] = headers['Accept-Encoding'] || 'gzip'
headers['User-Agent'] = headers['User-Agent'] || this.userAgent
this._add_proxy_headers(options.req, headers)
var method = options.method || 'GET'
var uri = options.uri_full || (this.config.url + options.uri)
@ -253,12 +254,12 @@ Storage.prototype.get_package = function(name, options, callback) {
headers['If-None-Match'] = options.etag
headers['Accept'] = 'application/octet-stream'
}
this._add_proxy_headers(options.req, headers)
this.request({
uri : '/' + encode(name),
json : true,
headers : headers,
req : options.req,
}, function(err, res, body) {
if (err) return callback(err)
if (res.statusCode === 404) {