HttpClientTestHelpers.cs 599 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Reflection;
  3. using System.Net.Http;
  4. namespace MonoTests.System.Net.Http
  5. {
  6. static class HttpClientTestHelpers
  7. {
  8. #if LEGACY_HTTPCLIENT
  9. internal static bool UsingSocketsHandler => false;
  10. #else
  11. internal static bool UsingSocketsHandler => true;
  12. #endif
  13. internal static bool IsSocketsHandler (HttpClientHandler handler) => UsingSocketsHandler;
  14. internal static HttpClient CreateHttpClient ()
  15. {
  16. return new HttpClient (CreateHttpClientHandler ());
  17. }
  18. internal static HttpClientHandler CreateHttpClientHandler ()
  19. {
  20. return new HttpClientHandler ();
  21. }
  22. }
  23. }