Example #1
0
File: Url.cs Project: llenroc/Flurl
		/// <summary>
		/// Constructs a Url object from a string.
		/// </summary>
		/// <param name="baseUrl">The URL to use as a starting point (required)</param>
		public Url(string baseUrl) {
			if (baseUrl == null)
				throw new ArgumentNullException("baseUrl");

			var parts = baseUrl.Split('?');
			Path = parts[0];
			QueryParams = QueryParamCollection.Parse(parts.Length > 1 ? parts[1] : "");
		}
Example #2
0
        /// <summary>
        /// Initialize UrlBuilder fields from url string
        /// </summary>
        /// <param name="baseUrl">Url as string</param>
        private void Initialize(string baseUrl)
        {
            uriBuilder = new UriBuilder(baseUrl);
            segments = new List<string>();
            hasTrailingSlash = false;
            SetPath(uriBuilder.Path);

            var query = uriBuilder.Query.TrimStart('?');
            queryParams = QueryParamCollection.Parse(query.Length > 1 ? query : string.Empty);
        }
Example #3
0
 /// <summary>
 /// Constructs a UrlBuilder object
 /// </summary>
 public UrlBuilder()
 {
     uriBuilder = new UriBuilder();
     segments = new List<string>();
     queryParams = new QueryParamCollection();
 }