mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Clean up directRequestHandler
This commit is contained in:
parent
0f58accbe2
commit
4f19bd9a38
1 changed files with 4 additions and 5 deletions
|
@ -66,17 +66,16 @@ const match = (uri, opts) => {
|
|||
}
|
||||
|
||||
const directRequestHandler = async (spData, opts) => {
|
||||
const res = await req(
|
||||
spData.proof.fetch ? spData.proof.fetch : spData.proof.uri,
|
||||
null,
|
||||
{ Accept: 'application/json' }
|
||||
)
|
||||
const url = spData.proof.fetch ? spData.proof.fetch : spData.proof.uri
|
||||
let res
|
||||
|
||||
switch (spData.proof.format) {
|
||||
case 'json':
|
||||
res = await req(url, null, { Accept: 'application/json' })
|
||||
return await res.json()
|
||||
break
|
||||
case 'text':
|
||||
res = await req(url)
|
||||
return await res.text()
|
||||
break
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue