Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PATCH, HEAD, and OPTIONS attributes. #225

Open
mccalltd opened this issue Mar 19, 2013 · 6 comments
Open

Add PATCH, HEAD, and OPTIONS attributes. #225

mccalltd opened this issue Mar 19, 2013 · 6 comments
Labels
Milestone

Comments

@mccalltd
Copy link
Owner

No description provided.

@abpatel
Copy link

abpatel commented Mar 20, 2013

Hi Tom,
This is a coincidence. I was just searching of these very attributes in the AttributeRouting codebase today and stumbled upon this post. Do you have a ballpark ETA for this item? I am using AttributeRouting with WebAPI and would much like to use PATCH in my action methods accepting Delta for partial entity updates.
TIA

@mccalltd
Copy link
Owner Author

No timeframe. You could just use [HttpRoute("url", HttpMethod.Patch)] for
now.

On Mar 19, 2013, at 7:03 PM, abpatel notifications@github.com wrote:

Hi Tom,
This is a coincidence. I was just searching of these very attributes in the
AttributeRouting codebase today and stumbled upon this post. Do you have a
ballpark ETA for this item? I am using AttributeRouting with WebAPI and
would much like to use PATCH in my action methods accepting Delta for
partial entity updates.
TIA


Reply to this email directly or view it on
GitHubhttps://github.com//issues/225#issuecomment-15153260
.

@abpatel
Copy link

abpatel commented Mar 20, 2013

That was preceisley what I was trying to do but the HttpMethod does not seem to have a the "Patch" verb property on it. Am I missing something?

@mccalltd
Copy link
Owner Author

Hmm. I think you are missing something. Can try a spike in the next day or
two. Should be there, though.

On Mar 19, 2013, at 8:31 PM, abpatel notifications@github.com wrote:

That was preceisley what I was trying to do but the HttpMethod does not
seem to have a the "Patch" verb property on it. Am I missing something?


Reply to this email directly or view it on
GitHubhttps://github.com//issues/225#issuecomment-15155322
.

@abpatel
Copy link

abpatel commented Mar 20, 2013

My reference is coming from the following location. Look right?

System.Net.Http.dll, v4.0.0.0
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Net.Http.dll

@abpatel
Copy link

abpatel commented Mar 21, 2013

For now I ended up defining my own PATCH attribute like so:
public class PATCHAttribute : HttpRouteAttribute
{
///

    /// Specify a route for a GET request.
    /// </summary>


    /// <param name="routeUrl">The url that is associated with this action</param>
    public PATCHAttribute(string routeUrl) : base(routeUrl, new HttpMethod("PATCH")) {}
}

and decorating my actions like so:
[PATCH("api/Products/{id}",RouteName="PatchProduct")]
public HttpResponseMessage PatchProduct(string id,Delta productDelta)
{
//do whatever with the delta
}

A side note: I have removed the "DefaultAPI" route from the WebAPIConfig.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants