aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/ApiService.cs
blob: 33ea492e05647066fe693fee8c8ee1317f5b51dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Net;

namespace MediaBrowser.Api
{
    /// <summary>
    /// Contains some helpers for the api
    /// </summary>
    public static class ApiService
    {
        /// <summary>
        /// Determines whether [is API URL match] [the specified URL].
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <param name="request">The request.</param>
        /// <returns><c>true</c> if [is API URL match] [the specified URL]; otherwise, <c>false</c>.</returns>
        public static bool IsApiUrlMatch(string url, HttpListenerRequest request)
        {
            url = "/api/" + url;

            return request.Url.LocalPath.EndsWith(url, StringComparison.OrdinalIgnoreCase);
        }
    }
}