Hey, recently I came across an interesting problem.
One of the endpoints in my service needs to return two or more Set-Cookie cookies at the same time.
Currently there is no way to create multiple Set-Cookies at the same time, and any attempt to change the type to an array will raise an error such as:
unsupported type in header: []string
I have two suggestions:
Let's add the possibility to apply an array type for the Set-Cookie type header
Allow for passing http.Cookie (and the array) the same as the request comes with http.Cookie, this would unify the types coming in and out
type MyAuthParams struct {
SessionCookie *http.Cookie `cookie:"session"`
}
Example of how I would see the proposal to be integrated:
type Response struct {
// example param with `header:"Set-Cookie"` as a string
Cookie string `header:"Set-Cookie"`
// example param with `header:"Set-Cookie"` as a []string
Cookies []string `header:"Set-Cookie"`
// example param with `header:"Set-Cookie"` as a *http.Cookie
Cookie *http.Cookie `header:"Set-Cookie"`
// example param with `header:"Set-Cookie"` as a []*http.Cookie
Cookies []*http.Cookie `header:"Set-Cookie"`
}
(obviously only one parameter with header:"Set-Cookie", just an example of multiple different types)
Hey, recently I came across an interesting problem.
One of the endpoints in my service needs to return two or more Set-Cookie cookies at the same time. Currently there is no way to create multiple Set-Cookies at the same time, and any attempt to change the type to an array will raise an error such as:
unsupported type in header: []string
I have two suggestions:
Example response from documentation
Example request from documentation
Example of how I would see the proposal to be integrated:
(obviously only one parameter with
header:"Set-Cookie"
, just an example of multiple different types)