abi
abi2y ago

Oak – ctx.assert with custom response headers

Am I doing this wrong? No extra custom headers are being set in the response as far as I can see in cURL:
ctx.assert(
!missingHeaders,
Status.BadRequest,
JSON.stringify({ error: `Required headers missing: ${missingHeaders}` }),
{ expose: true, headers: { "content-type": "application/json", "foo": "bar" } },
);
ctx.assert(
!missingHeaders,
Status.BadRequest,
JSON.stringify({ error: `Required headers missing: ${missingHeaders}` }),
{ expose: true, headers: { "content-type": "application/json", "foo": "bar" } },
);
1 Reply
abi
abiOP2y ago
I also tried doing { headers: new Headers({ ... }) } but it made no difference.