Tuple Support for Headers
Headers to allow the passing of tuples along these lines:
request.WithHeaders(("Accept", "application/json"), ("host", "localhost"), ("etc", "etc"))
Thanks. I like the idea. There's a few things I'd like to see before accepting this though:
-
System.ValueTupleis already included on new platforms, such as .NET Framework 4.7 and above. I would like the NuGet dependency in the csproj file to be conditional to only those platforms that need it. I believe this can be relied upon as a guide: https://blog.monstuff.com/archives/2017/03/valuetuple-availability.html (A lot of people use Flurl in Xamarin and Blazor apps and they WILL notice an unnecessary dependency.) -
For consistency, it would be great if tuples were supported everywhere throughout Flurl where parsing objects to name-value pairs is supported. This includes query strings, multipart, and cookies. Maybe others. If you search the code for
ToKeyValuePairsit should guide you to those things. -
WithHeaders(and other methods that get new overloads per # 2) should have equivalent extension methods forUrl,Uri, and string, in support of the various ways you can fluently string together statements. Flurl.Http.CodeGen should be modified and run to take care of those.
Happy to pick those up. That link is very useful as I was slightly surprised I needed to pull in value tuple. I haven't had to worry about 4.6.x - for quite sometime.
Thanks for the pointers as to other areas that would benefit. I was using test the other day and noticed that RespondWith and it's overloads might benefit as well.
On Thu, 30 Jul 2020, 20:07 Todd Menier, [email protected] wrote:
Thanks. I like the idea. There's a few things I'd like to see before accepting this though:
System.ValueTuple is already included on new platforms, such as .NET Framework 4.7 and above. I would like the NuGet dependency in the csproj file to be conditional to only those platforms that need it. I believe this can be relied upon as a guide: https://blog.monstuff.com/archives/2017/03/valuetuple-availability.html (A lot of people use Flurl in Xamarin and Blazor apps and they WILL notice an unnecessary dependency.) 2.
For consistency, it would be great if tuples were supported everywhere throughout Flurl where parsing objects to name-value pairs is supported. This includes query strings, multipart, and cookies. Maybe others. If you search the code for ToKeyValuePairs it should guide you to those things. 3.
WithHeaders (and other methods that get new overloads per # 2) should have equivalent extension methods for Url, Uri, and string, in support of the various ways you can fluently string together statements. Flurl.Http.CodeGen should be modified and run to take care of those.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tmenier/Flurl/pull/536#issuecomment-666608029, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNQXB5NOGPR7Y5JYPZDE2LR6HAGHANCNFSM4PFSVDKA .
Yes, funny you mention that about RespondWith. I tried to write a test involving multiple Set-Cookie headers and that's not so easy - tuples would work great. I've actually started modifying some of the internals of ToKeyValuePair to make special accommodations for IEnumerable<ValueTuple>. So we might end up working on this together. Can you hold off a few days?
Another thing I should mention is that this wouldn't get released before 3.0, and as part of that I may re-evaluate which platforms/versions I want to continue to support going forward. That could have some impact on if/how to include System.ValueTuple as well. Another reason to consider holding off a bit - I should have an answer on that soon.
More than happy to work on this together and a few days would suit me better too. Just shout when it works and we can coordinate. Probably better to move to a better coms platform in that case. Slack, WhatsApp a.n.other just let me know.
On Thu, 30 Jul 2020, 23:58 Todd Menier, [email protected] wrote:
Yes, funny you mention that about RespondWith. I tried to write a test involving multiple Set-Cookie headers and that's not so easy - tuples would work great. I've actually started modifying some of the internals of ToKeyValuePair to make special accommodations for IEnumerable<ValueTuple>. So we might end up working on this together. Can you hold off a few days?
Another thing I should mention is that this wouldn't get released before 3.0, and as part of that I may re-evaluate which platforms/versions I want to continue to support going forward. That could have some impact on if/how to include System.ValueTuple as well. Another reason to consider holding off a bit - I should have an answer on that soon.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tmenier/Flurl/pull/536#issuecomment-666761658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNQXBYBRRGRUG3WD5CRPBTR6H3IDANCNFSM4PFSVDKA .