Skip to content

Conversation

@BraeschAntoine
Copy link

@BraeschAntoine BraeschAntoine commented Nov 8, 2020

I recently opened an issue (#78 ), about adding optionnal headers to the saveImage / saveVideo methods, because sometimes you want to download images or ressources that are protected, by a bearer token for example. I simply added optionnal parameter to the saveImage and saveVideo methods which is an header parameter.
If a header parameter is here, it will be used by the get method.

Hope it will helps :)

print(url);
http.Client _client = new http.Client();
var req = await _client.get(Uri.parse(url));
var req = headers != null ? await _client.get(Uri.parse(url), headers: headers) : await _client.get(Uri.parse(url));

Choose a reason for hiding this comment

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

Does this break without the explicit null check? Seems from the implementation that it's not necessary.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah i overreacted and it doesn't break out without the null check i should correct that thax for highlighting it !

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.

2 participants