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

Support of context #105

Open
huttarichard opened this issue Nov 1, 2018 · 0 comments
Open

Support of context #105

huttarichard opened this issue Nov 1, 2018 · 0 comments
Labels

Comments

@huttarichard
Copy link

huttarichard commented Nov 1, 2018

Client library should always take context as a first argument of every function using http client or similar. Reason is simple if there is anything in way between client and intercom server it can go forever keeping whatever is using it blocked forever (not really that uncommon).

This would be expected behavior.

ctx, cancel := context.WithCancel(context.Background())
cancel()
_, err := ic.Users.Save(ctx, &user)
// err == context.Canceled  

luckily this can be solved by patching http client for now. But I suggest new release v3 supporting context as every good library does to avoid patching intercom's http client. Or to avoid new release there is an option to add postfix ...Ctx() to every method using http client.

Example:

_, err := ic.Users.SaveCtx(ctx, &user)
@choran choran added the go label Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants