Don't inject fetch polyfill in hkp module anymore
This commit is contained in:
parent
8070120b45
commit
dec7881f93
|
@ -18,7 +18,7 @@ module.exports = function(grunt) {
|
|||
browserifyOptions: {
|
||||
standalone: 'openpgp'
|
||||
},
|
||||
external: [ 'crypto', 'node-localstorage' ]
|
||||
external: [ 'crypto', 'node-localstorage', 'node-fetch' ]
|
||||
}
|
||||
},
|
||||
openpgp_debug: {
|
||||
|
@ -30,7 +30,7 @@ module.exports = function(grunt) {
|
|||
debug: true,
|
||||
standalone: 'openpgp'
|
||||
},
|
||||
external: [ 'crypto', 'node-localstorage' ]
|
||||
external: [ 'crypto', 'node-localstorage', 'node-fetch' ]
|
||||
}
|
||||
},
|
||||
worker: {
|
||||
|
@ -48,7 +48,7 @@ module.exports = function(grunt) {
|
|||
'test/lib/unittests-bundle.js': [ './test/unittests.js' ]
|
||||
},
|
||||
options: {
|
||||
external: ['crypto', 'node-localstorage', 'openpgp', '../../../dist/openpgp', '../../dist/openpgp']
|
||||
external: [ 'crypto', 'node-localstorage', 'node-fetch', 'openpgp', '../../dist/openpgp', '../../../dist/openpgp' ]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -31,14 +31,10 @@ var config = require('../config');
|
|||
* @constructor
|
||||
* @param {String} keyServerBaseUrl (optional) The HKP key server base url including
|
||||
* the protocol to use e.g. https://pgp.mit.edu
|
||||
* @param {function} fetch (optional) The fetch function is an easier way
|
||||
* to make web requests and handle responses than using an XMLHttpRequest. You can
|
||||
* pass in a custom implementaion or just leave the parameter empty to fall back to
|
||||
* window.fetch (https://fetch.spec.whatwg.org).
|
||||
*/
|
||||
function HKP(keyServerBaseUrl, fetch) {
|
||||
function HKP(keyServerBaseUrl) {
|
||||
this._baseUrl = keyServerBaseUrl ? keyServerBaseUrl : config.keyserver;
|
||||
this._fetch = fetch ? fetch : typeof window !== 'undefined' && window.fetch;
|
||||
this._fetch = typeof window !== 'undefined' ? window.fetch : require('node-fetch');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp');
|
||||
var fetch = typeof window !== 'undefined' ? window.fetch : require('node-fetch');
|
||||
|
||||
var chai = require('chai'),
|
||||
expect = chai.expect;
|
||||
|
@ -108,7 +107,7 @@ describe('HKP unit tests', function() {
|
|||
'-----END PGP PUBLIC KEY BLOCK-----';
|
||||
|
||||
beforeEach(function() {
|
||||
hkp = new openpgp.HKP(openpgp.config.keyserver, fetch);
|
||||
hkp = new openpgp.HKP(openpgp.config.keyserver);
|
||||
});
|
||||
|
||||
afterEach(function() {});
|
||||
|
|
Loading…
Reference in New Issue
Block a user