I have such a situation. We use some method to log in, but this method is at some higher level of abstraction, so it only has parameters such as username and password, and they make some collections of values ββby name with these parameters, and then passed to some query builder. This query constructor is introduced so that I can change its implementation. Now we use the POST request, but in the future we can use XML or JSON, so just switch the implementation of the injected interface.
The problem is that I cannot distinguish any library that will make me System.Net.HttpWebRequest from this collection of name values. I need a prototype method:
WebRequest / HttpWebRequest CreateRequest(Uri / string, nameValueCollection);
Or, if there isnβt anything like that, a library that does all the work (sending requests, receiving answers and analyzing them) will also be good. But it must be asynchronous.
Thanks in advance.
source share