fix(op): initialize http Headers in response objects (#637)
* fix(op): initialize http Headers in response objects * fix test --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
99301930ed
commit
1e75773eaa
2 changed files with 8 additions and 3 deletions
|
@ -428,6 +428,7 @@ func TestTryErrorRedirect(t *testing.T) {
|
||||||
parent: oidc.ErrInteractionRequired().WithDescription("sign in"),
|
parent: oidc.ErrInteractionRequired().WithDescription("sign in"),
|
||||||
},
|
},
|
||||||
want: &Redirect{
|
want: &Redirect{
|
||||||
|
Header: make(http.Header),
|
||||||
URL: "http://example.com/callback?error=interaction_required&error_description=sign+in&state=state1",
|
URL: "http://example.com/callback?error=interaction_required&error_description=sign+in&state=state1",
|
||||||
},
|
},
|
||||||
wantLog: `{
|
wantLog: `{
|
||||||
|
|
|
@ -218,6 +218,7 @@ type Response struct {
|
||||||
// without custom headers.
|
// without custom headers.
|
||||||
func NewResponse(data any) *Response {
|
func NewResponse(data any) *Response {
|
||||||
return &Response{
|
return &Response{
|
||||||
|
Header: make(http.Header),
|
||||||
Data: data,
|
Data: data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +243,10 @@ type Redirect struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRedirect(url string) *Redirect {
|
func NewRedirect(url string) *Redirect {
|
||||||
return &Redirect{URL: url}
|
return &Redirect{
|
||||||
|
Header: make(http.Header),
|
||||||
|
URL: url,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (red *Redirect) writeOut(w http.ResponseWriter, r *http.Request) {
|
func (red *Redirect) writeOut(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue