updated content-type for json mode
This commit is contained in:
parent
36002bb247
commit
4f43bbd6a7
5
index.ts
5
index.ts
@ -36,7 +36,8 @@ export default {
|
||||
return new Response(`Failed to convert output to UTF-8: ${err}`, { status: 500 })
|
||||
}
|
||||
|
||||
if (query.has('json')) output = JSON.stringify(parseXML(output))
|
||||
return new Response(output)
|
||||
const jsonMode = query.has('json')
|
||||
if (jsonMode) output = JSON.stringify(parseXML(output))
|
||||
return new Response(output, { headers: { 'Content-Type': jsonMode ? 'application/json' : 'text/xml' } })
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user