diff --git a/validator/keymanager/remote-web3signer/internal/client.go b/validator/keymanager/remote-web3signer/internal/client.go index 26ef849dd..e76d9922e 100644 --- a/validator/keymanager/remote-web3signer/internal/client.go +++ b/validator/keymanager/remote-web3signer/internal/client.go @@ -10,6 +10,7 @@ import ( "net/http/httputil" "net/url" "strconv" + "strings" "time" "github.com/ethereum/go-ethereum/common/hexutil" @@ -74,14 +75,13 @@ func (client *ApiClient) Sign(ctx context.Context, pubKey string, request SignRe return nil, fmt.Errorf("signing operation failed due to slashing protection rules, Signing Request URL: %v, Status: %v", client.BaseURL.String()+requestPath, resp.StatusCode) } contentType := resp.Header.Get("Content-Type") - switch contentType { - case "application/json": + if strings.HasPrefix(contentType, "application/json") { var sigResp SignatureResponse if err := unmarshalResponse(resp.Body, &sigResp); err != nil { return nil, err } return bls.SignatureFromBytes(sigResp.Signature) - default: + } else { return unmarshalSignatureResponse(resp.Body) } } diff --git a/validator/keymanager/remote-web3signer/internal/client_test.go b/validator/keymanager/remote-web3signer/internal/client_test.go index 7796090f3..793e5d27a 100644 --- a/validator/keymanager/remote-web3signer/internal/client_test.go +++ b/validator/keymanager/remote-web3signer/internal/client_test.go @@ -59,10 +59,10 @@ func TestClient_Sign_HappyPath_Jsontype(t *testing.T) { } jsonBytes, err := json.Marshal(sigResp) require.NoError(t, err) + require.NoError(t, err) // create a new reader with that JSON - header := http.Header{ - "Content-Type": []string{"application/json"}, - } + header := http.Header{} + header.Set("Content-Type", "application/json; charset=UTF-8") r := io.NopCloser(bytes.NewReader(jsonBytes)) mock := &mockTransport{mockResponse: &http.Response{ StatusCode: 200,