|
|
@ -40,8 +40,11 @@ type Pendinger interface { |
|
|
|
New() Pendinger |
|
|
|
} |
|
|
|
|
|
|
|
const apiPort = "4010" |
|
|
|
const apiURL = "http://localhost:" + apiPort + "/v1/" |
|
|
|
const ( |
|
|
|
apiPort = "4010" |
|
|
|
apiIP = "http://localhost:" |
|
|
|
apiURL = apiIP + apiPort + "/v1/" |
|
|
|
) |
|
|
|
|
|
|
|
var SetBlockchain = ` |
|
|
|
Type: Blockchain |
|
|
@ -847,6 +850,25 @@ func doBadReq(method, path string, reqBody io.Reader, expectedResponseCode int) |
|
|
|
return swagger.ValidateResponse(ctx, responseValidationInput) |
|
|
|
} |
|
|
|
|
|
|
|
func doSimpleReq(method, endpoint string) (string, error) { |
|
|
|
client := &http.Client{} |
|
|
|
httpReq, err := http.NewRequest(method, endpoint, nil) |
|
|
|
if err != nil { |
|
|
|
return "", tracerr.Wrap(err) |
|
|
|
} |
|
|
|
resp, err := client.Do(httpReq) |
|
|
|
if err != nil { |
|
|
|
return "", tracerr.Wrap(err) |
|
|
|
} |
|
|
|
//nolint
|
|
|
|
defer resp.Body.Close() |
|
|
|
body, err := ioutil.ReadAll(resp.Body) |
|
|
|
if err != nil { |
|
|
|
return "", tracerr.Wrap(err) |
|
|
|
} |
|
|
|
return string(body), nil |
|
|
|
} |
|
|
|
|
|
|
|
// test helpers
|
|
|
|
|
|
|
|
func getTimestamp(blockNum int64, blocks []common.Block) time.Time { |
|
|
|