diff --git a/lib/index.js b/lib/index.js index 9b303a6..75d2d35 100644 --- a/lib/index.js +++ b/lib/index.js @@ -65,6 +65,8 @@ function parseHeader(headers) { return raw; } +const crypto = require('crypto'); + function buildHash(url, args) { var json = {} if (args) { @@ -95,7 +97,12 @@ function buildFilenamePrefix(url, args, hash) { url = escape(url).replace(/\//g, '_') var method = args.method || 'GET' method = method.toUpperCase() - return url + '_' + method + '_' + hash + + var namehash = crypto.createHash('sha256'); + code = namehash.update(url); + digest = namehash.digest("base64").replace(/[^A-Za-z]/g, ""); + + return digest; // + '_' + method + '_' + hash } function buildOptionsFilename(url, args, hash) {