tsoa - setting multiple headers at once

23 Views Asked by At

I have a tsoa based service and I have there a JS object of headers I should set to the response.

Using just Express I could set multiple headers at once passing a JS object to res.set

res.set({
  'Content-Type': 'text/plain',
  'Content-Length': '123',
  'ETag': '12345'
})

Is there a way to do it with tsoa? Obviously I could create my own function iterating through the JS object and setting the headers one by one, e.g.

    Object.entries(headersObject).forEach(([key, value]) => {
        tsoaResponse.setHeader(key, value)
    })

but my question is whether there is a ready tsoa way for that, because I could find only

        tsoaResponse.setHeader(key, value)

that doesn't support a way of setting multiple headers at once from a JS object

0

There are 0 best solutions below