mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Add proxyRequestHandler
This commit is contained in:
parent
596db98bfd
commit
2ac42a6edf
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue