fix(xo-server/xo.exportConfig): dont return 200 on failure
`writeHead` sends immediatly the response header, which has a number of undesirable side-effects. For instance, in this case, it prevented returning a 500 code in case of error. It's almost always preferable to use `statusCode`, `writeHead()` or Express methods like `set()`.
This commit is contained in:
parent
c79ebfdd0a
commit
ec899be3b5
@ -18,7 +18,7 @@ export async function exportConfig() {
|
||||
return {
|
||||
$getFrom: await this.registerHttpRequest(
|
||||
(req, res) => {
|
||||
res.writeHead(200, 'OK', {
|
||||
res.set({
|
||||
'content-disposition': 'attachment',
|
||||
'content-type': 'application/json',
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user