|
|
@ -41,7 +41,8 @@ type Pendinger interface { |
|
|
|
} |
|
|
|
|
|
|
|
const apiPort = "4010" |
|
|
|
const apiURL = "http://localhost:" + apiPort + "/v1/" |
|
|
|
const apiIP = "http://localhost:" |
|
|
|
const apiURL = apiIP + apiPort + "/v1/" |
|
|
|
|
|
|
|
var SetBlockchain = ` |
|
|
|
Type: Blockchain |
|
|
@ -841,6 +842,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 { |
|
|
|