Skip to content
This repository was archived by the owner on Oct 9, 2022. It is now read-only.

Commit 22fd6f9

Browse files
authored
Fix providers.NewHTTPProvider https protocol check (#110)
* Fix providers.NewHTTPProvider https protocol check * Fix golint
1 parent 7ec0944 commit 22fd6f9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/shadow/eth/receipt.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ func GetChainBlockInfo(api string, blockNum int64) (*BlockResult, error) {
5555
}
5656

5757
func RPC(api string, method string, params interface{}) (*dto.RequestResult, error) {
58-
provider := providers.NewHTTPProvider(strings.ReplaceAll(api, "https://", ""), 10, true)
58+
replacer := strings.NewReplacer("https://", "", "http://", "")
59+
provider := providers.NewHTTPProvider(replacer.Replace(api), 10, strings.HasPrefix(api, "https://"))
5960
pointer := &dto.RequestResult{}
6061
err := provider.SendRequest(pointer, method, params)
6162
if err != nil {

0 commit comments

Comments
 (0)