Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Unassigned: Custom OData Actions do not respect 204 return values. [1571]

$
0
0
WebApi.Register
```
ActionConfiguration sampleAction = odataConventionModelBuilder.Entity<SampleEntity>().Action("SampleAction");
```

Controller
```
[HttpPost]
[Queryable]
public IHttpActionResult SampleAction(int key)
{
return StatusCode(HttpStatusCode.NoContent);
}
```

This throws a 500 error.
```
{
"odata.error":{
"code":"","message":{
"lang":"en-US","value":"An error has occurred."
},"innererror":{
"message":"Object reference not set to an instance of an object.","type":"System.NullReferenceException","stacktrace":" at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()"
}
}
}
```

Section 10.4.1.3 states:
> On success, the response SHOULD be 200 for actions with a return type or 204 for action without a return type.

__[kichalla]__ : Added repro (1 action returning queryable and one not)
Comments: Missed adding this detail in my previous comment: The issue here is with QueryableAttribute and the code pasted in the previous comment is from QueryAttribute's OnActionExecuted method...

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>