Skip to content

Commit

Permalink
Merge branch 'release/v1.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
onetechnical committed Apr 27, 2021
2 parents 23e6f18 + 5d59dfc commit 830369b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.7.0
# Bugfix
- Fix GetGenesis endpoint.
# 1.6.0
# Added
- Code generation for more of the http client
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build: generate

unit:
go test $(TEST_SOURCES_NO_CUCUMBER)
cd test && go test --godog.strict=true --godog.format=pretty --godog.tags="@unit.offline,@unit.algod,@unit.indexer,@unit.rekey,@unit.tealsign,@unit.dryrun,@unit.responses,@unit.applications,@unit.transactions,@unit.indexer.rekey,@unit.responses.messagepack,@unit.responses.231,@unit.responses.messagepack.231" --test.v .
cd test && go test --godog.strict=true --godog.format=pretty --godog.tags="@unit.offline,@unit.algod,@unit.indexer,@unit.rekey,@unit.tealsign,@unit.dryrun,@unit.responses,@unit.applications,@unit.transactions,@unit.indexer.rekey,@unit.responses.messagepack,@unit.responses.231,@unit.responses.messagepack.231,@unit.responses.genesis" --test.v .

integration:
go test $(TEST_SOURCES_NO_CUCUMBER)
Expand Down
6 changes: 6 additions & 0 deletions client/v2/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ func (client *Client) submitForm(ctx context.Context, response interface{}, path

responseErr := extractError(resp.StatusCode, bodyBytes)

// The caller wants a string
if strResponse, ok := response.(*string); ok {
*strResponse = string(bodyBytes)
return err
}

// Attempt to unmarshal a response regardless of whether or not there was an error.
err = json.Unmarshal(bodyBytes, response)
if responseErr != nil {
Expand Down
6 changes: 5 additions & 1 deletion test/indexer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,11 @@ func theParsedResponseShouldEqual(jsonfileName string) error {
var responseJson string

baselinePath := path.Join("./features/resources/", jsonfileName)
responseJson = string(json.Encode(response))
if responseStr, ok := response.(string); ok {
responseJson = responseStr
} else {
responseJson = string(json.Encode(response))
}

return VerifyResponse(baselinePath, responseJson)
}
Expand Down
8 changes: 7 additions & 1 deletion test/responses_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ func weMakeAnyCallTo(client /* algod/indexer */, endpoint string) (err error) {
response, err = algodC.TealDryrun(models.DryrunRequest{}).Do(context.Background())
case "Proof":
response, err = algodC.GetProof(10, "asdf").Do(context.Background())
case "GetGenesis":
response, err = algodC.GetGenesis().Do(context.Background())
case "any":
// This is an error case
// pickup the error as the response
Expand Down Expand Up @@ -169,7 +171,11 @@ func theParsedResponseShouldEqualTheMockResponse() error {
parts := strings.SplitAfterN(responseJson, ":", 2)
responseJson = parts[1]
} else {
responseJson = string(json.Encode(response))
if responseStr, ok := response.(string); ok {
responseJson = responseStr
} else {
responseJson = string(json.Encode(response))
}
}

return VerifyResponse(baselinePath, responseJson)
Expand Down

0 comments on commit 830369b

Please sign in to comment.