mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49: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 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:
|
||||||
|
|
Loading…
Reference in a new issue