ApiService.cs 750 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Net;
  3. namespace MediaBrowser.Api
  4. {
  5. /// <summary>
  6. /// Contains some helpers for the api
  7. /// </summary>
  8. public static class ApiService
  9. {
  10. /// <summary>
  11. /// Determines whether [is API URL match] [the specified URL].
  12. /// </summary>
  13. /// <param name="url">The URL.</param>
  14. /// <param name="request">The request.</param>
  15. /// <returns><c>true</c> if [is API URL match] [the specified URL]; otherwise, <c>false</c>.</returns>
  16. public static bool IsApiUrlMatch(string url, HttpListenerRequest request)
  17. {
  18. url = "/api/" + url;
  19. return request.Url.LocalPath.EndsWith(url, StringComparison.OrdinalIgnoreCase);
  20. }
  21. }
  22. }