mccalltd / AttributeRouting

Define your routes using attributes on actions in ASP.NET MVC and Web API.
http://mccalltd.github.io/AttributeRouting/
MIT License
416 stars 89 forks source link

Model binding #242

Closed paulmalyschko closed 11 years ago

paulmalyschko commented 11 years ago

I'm having some trouble with model binding with AttributeRouting ASP.NET Web API, though I don't know if this is a bug, an unimplemented feature or my own inexperience (likely the latter). I have an ApiController as follows:

[RoutePrefix("servers/{serverId}")]
public class UsersController : ApiController
{
    [POST("users"), HttpPost]
    public HttpResponseMessage SubscribeUser(string serverId, SubscribeUserRequest request)
    {
        ...
    }
}

The request is sent with a corresponding JSON body that reflects the SubscribeUserRequest model (already double-checked that). There's a lot of magic when model binding occurs, so I don't know if I'm even doing this correctly, or if I need to grab the JSON manually. Any help would be appreciated.

paulmalyschko commented 11 years ago

Forget it. JSON wasn't stringified. Thank you for this wonderful software!