Skip to content

Commit

Permalink
internal-endpoint-testing: handle x-choreo-test-session-id header cor…
Browse files Browse the repository at this point in the history
…s config

Signed-off-by: Lahiru De Silva <[email protected]>
  • Loading branch information
NomadXD committed Jan 23, 2024
1 parent 107edec commit 2eefbde
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ func TestGetCorsPolicy(t *testing.T) {
// Test the configuration when headers configuration is not provided.
corsPolicy3 := getCorsPolicy(corsConfigModel3)
assert.NotNil(t, corsPolicy3, "Cors Policy should not be null.")
assert.Empty(t, corsPolicy3.GetAllowHeaders(), "Cors Allow headers should be null.")
assert.Equal(t, "x-choreo-test-session-id", corsPolicy3.GetAllowHeaders(), "Cors Allow headers mismatch")
assert.Empty(t, corsPolicy3.GetExposeHeaders(), "Cors Expose Headers should be null.")
assert.NotEmpty(t, corsPolicy3.GetAllowOriginStringMatch(), "Cors Allowded Origins should not be null.")
assert.Equal(t, regexp.QuoteMeta("http://test1.com"),
Expand All @@ -737,7 +737,7 @@ func TestGetCorsPolicy(t *testing.T) {
err := routeWithoutCors.GetTypedPerFilterConfig()[wellknown.CORS].UnmarshalTo(corsConfig1)

assert.Nilf(t, err, "Error while parsing Cors Configuration %v", corsConfig1)
assert.Empty(t, corsConfig1.GetAllowHeaders(), "Cors AllowHeaders should be empty.")
assert.Equal(t, "x-choreo-test-session-id", corsConfig1.GetAllowHeaders(), "Cors Allow headers mismatch")
assert.Empty(t, corsConfig1.GetAllowCredentials(), "Cors AllowCredentials should be empty.")
assert.Empty(t, corsConfig1.GetAllowMethods(), "Cors AllowMethods should be empty.")
assert.Empty(t, corsConfig1.GetAllowOriginStringMatch(), "Cors AllowOriginStringMatch should be empty.")
Expand Down

0 comments on commit 2eefbde

Please sign in to comment.