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

Cannot handle actions that return only Task #41

Open
tmdude9586 opened this issue Sep 22, 2016 · 3 comments
Open

Cannot handle actions that return only Task #41

tmdude9586 opened this issue Sep 22, 2016 · 3 comments

Comments

@tmdude9586
Copy link

I have a controller action which has the following signature

public async Task Delete(int id);

it returns Task so that the webapi will return a 204 No Content by default. However the RouteLinker.GetUriAsync is type parameterized and expects the 2nd argument to be a parameterized Task.

errormessage

I think there should be a non generic version of the method that has the following signature:

public Task<Uri> GetUriAsync<T>(Expression<Func<T, Task>> method);

@ploeh
Copy link
Owner

ploeh commented Sep 23, 2016

That sounds like a reasonable addition.

As a workaround, could you return this.StatusCode(HttpStatusCode.NoContent)? AFAICT, this would achieve the same result, while keeping the return value of your method Task<IHttpActionResult>.

All that said, I'd recommend avoiding 204 responses.

@dave-q
Copy link

dave-q commented Oct 16, 2017

is this still in need of doing?

@ploeh
Copy link
Owner

ploeh commented Oct 17, 2017

Yes, I think I'd have closed the issue if this was resolved.

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

No branches or pull requests

3 participants