0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

Merge pull request #274 from verdaccio/fix_268_refactor

refactor: fix #268 in a better way
This commit is contained in:
Juan Picado @jotadeveloper 2017-07-29 11:17:19 +02:00 committed by GitHub
commit fdc9624d70

View file

@ -13,6 +13,9 @@ const zlib = require('zlib');
const encode = function(thing) {
return encodeURIComponent(thing).replace(/^%40/, '@');
};
const contenTypeAccept = 'application/octet-stream, application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*';
/**
* Just a helper (`config[key] || default` doesn't work because of zeroes)
* @param {Object} config
@ -231,6 +234,7 @@ class ProxyStorage {
const headers = {};
if (_.isNil(options.etag) === false) {
headers['If-None-Match'] = options.etag;
headers['Accept'] = contenTypeAccept;
}
this.request({
@ -267,7 +271,9 @@ class ProxyStorage {
let readStream = this.request({
uri_full: url,
encoding: null,
headers: {Accept: 'application/octet-stream'},
headers: {
Accept: contenTypeAccept,
},
});
readStream.on('response', function(res) {