From 2ac42a6edfcc656a299d9de41e923354e6676bf2 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Wed, 4 Nov 2020 03:02:15 +0100 Subject: [PATCH] Add proxyRequestHandler --- src/serviceproviders.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/serviceproviders.js b/src/serviceproviders.js index 9435c93..9a975e5 100644 --- a/src/serviceproviders.js +++ b/src/serviceproviders.js @@ -15,6 +15,7 @@ limitations under the License. */ const bent = require('bent') const req = bent('GET') +const utils = require('./utils') const list = [ 'dns', @@ -78,7 +79,10 @@ const directRequestHandler = async (spData) => { } const proxyRequestHandler = async (spData) => { - return null + const url = spData.proof.fetch ? spData.proof.fetch : spData.proof.uri + const res = await req(utils.generateProxyURL(spData.proof.format, url), 'json', { Accept: 'application/json' }) + const json = await res.json() + return json.content } exports.list = list