Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST client: always set Exclude value in accountInformationParams #3728

Merged
merged 2 commits into from
Mar 25, 2022

Conversation

cce
Copy link
Contributor

@cce cce commented Mar 8, 2022

Summary

Small tweak, this sets the "exclude" parameter for both all/none cases used by the algod RestClient.AccountInformationV2 method, rather than an empty string for one of the cases.

Test Plan

Existing tests should pass.

@cce cce requested a review from a user March 8, 2022 16:08
@cce cce changed the title nit: always set Exclude value in accountInformationParams REST client: always set Exclude value in accountInformationParams Mar 8, 2022
@cce cce self-assigned this Mar 8, 2022
@cce cce added the Enhancement label Mar 8, 2022
Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't we want to keep the old endpoint also support the empty form for backward compatibility ?

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to any particular undesired behavior you've seen ?

Copy link
Contributor

@algonautshant algonautshant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also check (and fix) the comments below (lines 493-499):

// AccountAssetInformation gets account information about a given app.
func (client RestClient) AccountAssetInformation(accountAddress string, assetID uint64) (response generatedV2.AccountAssetResponse, err error) {
	err = client.get(&response, fmt.Sprintf("/v2/accounts/%s/assets/%d", accountAddress, assetID), nil)
	return
}
// RawAccountAssetInformation gets account information about a given app.
func (client RestClient) RawAccountAssetInformation(accountAddress string, assetID uint64) (response []byte, err error) {
	var blob Blob
	err = client.getRaw(&blob, fmt.Sprintf("/v2/accounts/%s/assets/%d", accountAddress, assetID), rawFormat{Format: "msgpack"})
	response = blob
	return
}

@cce
Copy link
Contributor Author

cce commented Mar 10, 2022

a different fix would be to have the client not pass "?exclude" at all if the Exclude string is empty. This is conforming to the spec. To pass ?exclude=&somethingelse=Y as the client is doing is not conformant.

algorandskiy
algorandskiy previously approved these changes Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants