mirror of
https://github.com/coder/coder.git
synced 2025-03-14 10:09:57 +00:00
fix(vpn/tunnel): fix panic when starting tunnel with headers (#16565)
`http.Header` is a map so it needs to be initialized ..
This commit is contained in:
@ -230,7 +230,7 @@ func (t *Tunnel) start(req *StartRequest) error {
|
||||
if apiToken == "" {
|
||||
return xerrors.New("missing api token")
|
||||
}
|
||||
var header http.Header
|
||||
header := make(http.Header)
|
||||
for _, h := range req.GetHeaders() {
|
||||
header.Add(h.GetName(), h.GetValue())
|
||||
}
|
||||
|
@ -100,6 +100,9 @@ func TestTunnel_StartStop(t *testing.T) {
|
||||
TunnelFileDescriptor: 2,
|
||||
CoderUrl: "https://coder.example.com",
|
||||
ApiToken: "fakeToken",
|
||||
Headers: []*StartRequest_Header{
|
||||
{Name: "X-Test-Header", Value: "test"},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user