New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to set more than one cookie #637
Comments
Sorry about my lack of knowledge here. Does this only apply to |
I've made some investigations about the subject. Another thing I discovered: Issue can(and probably should) be solved just by allowing |
Bump, I have this exact same issue. I want to use passport jwt with tsoa which requires me to set both the token and the refreshToken from the login endpoint. i.e.:,
Currently this results in only the I tried to checkout the tsoa code and make relevant changes for a PR, but unfortunately I don't undestrand the code of tsoa well enough to make that change. |
@lassemon At least with We used it in our project. You should be able to do :
Typescript will complain, as theoretically the method accepts So you would end up with // @ts-expect-error
this.setHeader('Set-Cookie', [`token=${authToken}; HttpOnly`, `refreshToken=${refreshToken}; HttpOnly`]); |
@tsimbalar Yes thank you!! |
Unable to set more than one cookie
Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
Multiple Set-Cookie headers with different names should be allowed to set with Controller.setHeader() method
Current Behavior
Controller.setHeader() method now adds new header to the object with signature:
{ [name: string]: string | undefined }
Which makes impossible to add multiple headers of the same type. But it should be possible, at least for Set-Cookies header RFC6265
Possible Solution
Change the signature of headers property in Controller to { [name: string]: string | undefined }[]
Change templates for routes with support for set Multiple headers
The text was updated successfully, but these errors were encountered: