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

Pst/custom token #33

Merged
merged 4 commits into from
Sep 20, 2019
Merged

Pst/custom token #33

merged 4 commits into from
Sep 20, 2019

Conversation

fgamundi
Copy link
Contributor

@fgamundi fgamundi commented Aug 2, 2019

Add support for multiple different headers - backwards compatible for existing code

@Vervious
Copy link
Contributor

Since go-algorand doesn't support other api tokens this change seems orthogonal and complicates the client. Perhaps we should consider having a Pst fork?

@Vervious
Copy link
Contributor

Hi @fxgamundi, thoughts on us closing this pull request for the aforementioned reason? Or is there a good rationale for this change to be added?

@fgamundi
Copy link
Contributor Author

fgamundi commented Aug 21, 2019 via email

@bjweaver
Copy link

Worth noting that the JS SDK supports both X-Api-Key and X-Algo-API-Token, so it would be ideal if the Go SDK did as well.

Copy link
Contributor

@rotemh rotemh left a comment

Choose a reason for hiding this comment

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

For better type safety and to not change interfaces, I rather avoid using the empty interface. Please consider simply adding MakeClientWithHeaders(address string, apiToken string, headers []Header) instead of the combined version. Besides that, looks good.

@fgamundi
Copy link
Contributor Author

We added the new factory function to create an algod client with headers.
Also modified the client's functions accept additional headers for each specific request, making it on par with the Python SDK.
The best approach that we could think of for this was making the functions variadic, with the headers as the last arg of the functions. This guaranties that the functions can be called without any headers, just one, or a slice of them, making it fully backwards compatible.

@pzbitskiy pzbitskiy requested review from pzbitskiy and removed request for Vervious September 20, 2019 18:29
@pzbitskiy pzbitskiy merged commit ac0ec33 into algorand:master Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants