@@ -15,7 +15,7 @@ import (
15
15
"testing"
16
16
"time"
17
17
18
- "github.com/form3tech-oss/go-http-message-signatures"
18
+ httpsignatures "github.com/form3tech-oss/go-http-message-signatures"
19
19
"github.com/form3tech-oss/http-message-signing-proxy/cmd"
20
20
"github.com/stretchr/testify/suite"
21
21
)
@@ -37,6 +37,7 @@ const (
37
37
38
38
type e2eTestSuite struct {
39
39
suite.Suite
40
+ accessControlAllowOrigin string
40
41
}
41
42
42
43
func (s * e2eTestSuite ) msgVerifier () * httpsignatures.MessageVerifier {
@@ -86,10 +87,11 @@ func (s *e2eTestSuite) runProxy(upstreamTarget string) {
86
87
rootCmd .SetArgs (append (
87
88
[]string {"--config" , cfgFile },
88
89
genSetFlags (map [string ]string {
89
- "server.ssl.certFilePath" : sslCertFile ,
90
- "server.ssl.keyFilePath" : sslKeyFile ,
91
- "proxy.signer.keyFilePath" : privateKeyFile ,
92
- "proxy.upstreamTarget" : upstreamTarget ,
90
+ "server.ssl.certFilePath" : sslCertFile ,
91
+ "server.ssl.keyFilePath" : sslKeyFile ,
92
+ "proxy.signer.keyFilePath" : privateKeyFile ,
93
+ "proxy.upstreamTarget" : upstreamTarget ,
94
+ "server.accessControlAllowOrigin" : s .accessControlAllowOrigin ,
93
95
})... ,
94
96
))
95
97
go func () {
@@ -167,6 +169,7 @@ func (s *e2eTestSuite) TestProxy() {
167
169
r , err := http .DefaultClient .Do (req )
168
170
s .NoError (err )
169
171
s .Equal (test .expectedStatus , r .StatusCode )
172
+ s .Equal (s .accessControlAllowOrigin , r .Header .Get ("Access-Control-Allow-Origin" ))
170
173
171
174
if test .expectedStatus == http .StatusOK {
172
175
resp , err := readHttpResp [successResp ](r )
@@ -186,7 +189,7 @@ func (s *e2eTestSuite) TestProxy() {
186
189
}
187
190
188
191
func TestE2ETestSuite (t * testing.T ) {
189
- suite .Run (t , new ( e2eTestSuite ) )
192
+ suite .Run (t , & e2eTestSuite { accessControlAllowOrigin : "*" } )
190
193
}
191
194
192
195
func genSetFlags (m map [string ]string ) []string {
0 commit comments