-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: validate validator addresses in update-validator-auths proposal (#…
…411) * refactor: edit cli function names and use same conversion rules * test: add consortium query tests * fix: validate validator addresses in update-validator-auths proposal * test: add consortium tx tests * chore: lint * refactor: switch function locations * test: add consortium grpc query tests * feat: remove legacy REST * refactor: switch locations of grpc queries * chore: lint * docs: update CHANGELOG * test: use ioutil * fix: add address validation into `ValidateBasic()` * refactor: make cli rely on the content's validation logic * refactor: use same conversion rules
- Loading branch information
Showing
20 changed files
with
995 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Package rest provides HTTP types and primitives for REST | ||
// requests validation and responses handling. | ||
package rest | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"io/ioutil" | ||
"net/http" | ||
) | ||
|
||
// GetRequest defines a wrapper around an HTTP GET request with a provided URL. | ||
// An error is returned if the request or reading the body fails. | ||
func GetRequest(url string) ([]byte, error) { | ||
res, err := http.Get(url) // nolint:gosec | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer res.Body.Close() | ||
|
||
body, err := ioutil.ReadAll(res.Body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return body, nil | ||
} | ||
|
||
// PostRequest defines a wrapper around an HTTP POST request with a provided URL and data. | ||
// An error is returned if the request or reading the body fails. | ||
func PostRequest(url string, contentType string, data []byte) ([]byte, error) { | ||
res, err := http.Post(url, contentType, bytes.NewBuffer(data)) // nolint:gosec | ||
if err != nil { | ||
return nil, fmt.Errorf("error while sending post request: %w", err) | ||
} | ||
defer res.Body.Close() | ||
|
||
bz, err := ioutil.ReadAll(res.Body) | ||
if err != nil { | ||
return nil, fmt.Errorf("error reading response body: %w", err) | ||
} | ||
|
||
return bz, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// +build norace | ||
|
||
package testutil | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
|
||
"github.com/line/lbm-sdk/testutil/network" | ||
) | ||
|
||
func TestIntegrationTestSuite(t *testing.T) { | ||
cfg := network.DefaultConfig() | ||
cfg.NumValidators = 1 | ||
suite.Run(t, NewIntegrationTestSuite(cfg)) | ||
} |
Oops, something went wrong.