You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing System.Web.Http using in generated file #86
Adding a reference to System.Web.Http will solve the problem but leaving it with another reference to another assembly that it really doesn't need on the client side. We don't want to do this.
The return type IHttpActionResult is an abstraction of a HttpResponseMessage and therefore needs to be generated as HttpResponseMessage instead of an interface, (given that ResponseType isn't explicitly specified on the method of the controller).
I've noticed that this does indeed gets generated like mentioned above, but only some of the methods and will push out a bug fix that addresses this shortly.
In the meanwhile I would suggest explicitly specifying the return type using ResponseType when using IHttpActionResult responses.
After further investigation on this issue (and hoping it was changed by an accidental merge earlier on), I found that this specific scenario is implemented by design to enforce the use of ResponseType on actions.
It generates 3 methods, 2 of which returns a standard HttpResponseMessage by default:
A special async message e.g. Task<HttpResponseMessage> FooAsyncMsg()
A normal async e.g. Task<HttpResponseMessage> FooAsync()
A concrete e.g. Bar Foo()
Really don't know what the actual difference (or use) is between nr. 1 & 2, therefor I suggest the following:
A special async (as message) e.g. Task<HttpResponseMessage> FooAsyncMessage()
Activity
YetAnotherPhil commentedon Jun 26, 2016
This is still an issue with the latest version (1.3.6021.11899).
Please can you add
using System.Web.Http;to avoid error:Here is an example method:
IHttpActionResult Delete(int MyID);that generates the error.TY
faniereynders commentedon Jun 26, 2016
Adding a reference to
System.Web.Httpwill solve the problem but leaving it with another reference to another assembly that it really doesn't need on the client side. We don't want to do this.The return type
IHttpActionResultis an abstraction of aHttpResponseMessageand therefore needs to be generated asHttpResponseMessageinstead of an interface, (given thatResponseTypeisn't explicitly specified on the method of the controller).I've noticed that this does indeed gets generated like mentioned above, but only some of the methods and will push out a bug fix that addresses this shortly.
In the meanwhile I would suggest explicitly specifying the return type using
ResponseTypewhen usingIHttpActionResultresponses.YetAnotherPhil commentedon Jun 26, 2016
Fair comment, thx for the speedy reply. Cheers
faniereynders commentedon Jun 26, 2016
After further investigation on this issue (and hoping it was changed by an accidental merge earlier on), I found that this specific scenario is implemented by design to enforce the use of
ResponseTypeon actions.It generates 3 methods, 2 of which returns a standard
HttpResponseMessageby default:Task<HttpResponseMessage> FooAsyncMsg()Task<HttpResponseMessage> FooAsync()Bar Foo()Really don't know what the actual difference (or use) is between nr. 1 & 2, therefor I suggest the following:
Task<HttpResponseMessage> FooAsyncMessage()Task<Bar> FooAsync()Bar Foo()faniereynders commentedon Jun 26, 2016
The only thing is that it still shouldn't break if one doesn't use
ResponseType. It should fall back toHttpResponseMessageIMHO