Clean up directRequestHandler

This commit is contained in:
Yarmo Mackenbach 2020-11-17 02:03:34 +01:00
parent 0f58accbe2
commit 4f19bd9a38

View file

@ -66,17 +66,16 @@ const match = (uri, opts) => {
} }
const directRequestHandler = async (spData, opts) => { const directRequestHandler = async (spData, opts) => {
const res = await req( const url = spData.proof.fetch ? spData.proof.fetch : spData.proof.uri
spData.proof.fetch ? spData.proof.fetch : spData.proof.uri, let res
null,
{ Accept: 'application/json' }
)
switch (spData.proof.format) { switch (spData.proof.format) {
case 'json': case 'json':
res = await req(url, null, { Accept: 'application/json' })
return await res.json() return await res.json()
break break
case 'text': case 'text':
res = await req(url)
return await res.text() return await res.text()
break break
default: default: