Skip to content

Commit

Permalink
Fixes maartenba#230, default HTTP method set incorrectly for DynamicN…
Browse files Browse the repository at this point in the history
…odes. Also added HttpMethod property to DynamicNode so HttpMethod can be set.
  • Loading branch information
NightOwl888 committed Sep 20, 2013
1 parent d5e6a4e commit 57cb085
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/MvcSiteMapProvider/MvcSiteMapProvider/DynamicNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ public UpdatePriority UpdatePriority
/// <value>The sort order.</value>
public int? Order { get; set; }

/// <summary>
/// Gets or sets the HTTP method (such as GET, POST, or HEAD).
/// </summary>
/// <value>
/// The HTTP method.
/// </value>
public string HttpMethod { get; set; }

/// <summary>
/// Copies the values for matching properties on an <see cref="T:MvcSiteMapNodeProvider.ISiteMapNode"/> instance, but
/// doesn't overwrite any values that are not set in this <see cref="T:MvcSiteMapNodeProvider.DynamicNode"/> instance.
Expand Down Expand Up @@ -236,6 +244,8 @@ public void SafeCopyTo(ISiteMapNode node)
}
if (this.Order != null)
node.Order = (int)this.Order;
if (!string.IsNullOrEmpty(this.HttpMethod))
node.HttpMethod = this.HttpMethod;
}


Expand Down
9 changes: 7 additions & 2 deletions src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ IUrlPath urlPath
protected readonly ISiteMap siteMap;
protected readonly string key;
protected readonly bool isDynamic;
protected string httpMethod = "*";
protected string title = String.Empty;
protected string description = String.Empty;
protected string imageUrl = String.Empty;
Expand Down Expand Up @@ -114,12 +115,16 @@ public override ISiteMap SiteMap
}

/// <summary>
/// Gets or sets the HTTP method.
/// Gets or sets the HTTP method (such as GET, POST, or HEAD).
/// </summary>
/// <value>
/// The HTTP method.
/// </value>
public override string HttpMethod { get; set; }
public override string HttpMethod
{
get { return this.httpMethod; }
set { this.httpMethod = value; }
}

/// <summary>
/// Gets the implicit resource key (optional).
Expand Down

0 comments on commit 57cb085

Please sign in to comment.