Skip to content

Commit

Permalink
add prints when failing CORS (#1520)
Browse files Browse the repository at this point in the history
  • Loading branch information
omerlavanet authored Jun 30, 2024
1 parent 461681e commit 5d85548
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions protocol/rpcprovider/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func validateCORSHeaders(resp *http.Response) error {
// Check for the presence of "Access-Control-Allow-Origin" header
corsOrigin := resp.Header.Get("Access-Control-Allow-Origin")
if corsOrigin != "*" {
return utils.LavaFormatError("CORS check failed. Expected 'Access-Control-Allow-Origin: *' but not found.", nil, utils.Attribute{Key: "corsOrigin", Value: corsOrigin})
return utils.LavaFormatError("CORS check failed. Expected 'Access-Control-Allow-Origin: *' but not found.", nil, utils.Attribute{Key: "returned code", Value: resp.StatusCode}, utils.Attribute{Key: "corsOrigin", Value: corsOrigin})
}

// Headers that must be present in "Access-Control-Allow-Headers"
Expand Down Expand Up @@ -179,7 +179,7 @@ func startTesting(ctx context.Context, clientCtx client.Context, providerEntries

// CORS check
if err := PerformCORSCheck(endpoint); err != nil {
return 0, versions, 0, err
return 0, versions, 0, utils.LavaFormatError("invalid CORS check", err, utils.Attribute{Key: "returnedGuid", Value: probeResp.GetGuid()}, utils.Attribute{Key: "guid", Value: guid}, utils.Attribute{Key: "apiInterface", Value: apiInterface}, utils.Attribute{Key: "addon", Value: addon}, utils.Attribute{Key: "chainID", Value: providerEntry.Chain}, utils.Attribute{Key: "network address", Value: endpoint.IPPORT})
}

relayRequest := &pairingtypes.RelayRequest{
Expand Down

0 comments on commit 5d85548

Please sign in to comment.