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

Commit

Permalink
Fix providers.NewHTTPProvider https protocol check (#110)
Browse files Browse the repository at this point in the history
* Fix providers.NewHTTPProvider https protocol check

* Fix golint
  • Loading branch information
freehere107 authored Nov 5, 2020
1 parent 7ec0944 commit 22fd6f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/shadow/eth/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ func GetChainBlockInfo(api string, blockNum int64) (*BlockResult, error) {
}

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

0 comments on commit 22fd6f9

Please sign in to comment.