Web-Anchor icon indicating copy to clipboard operation
Web-Anchor copied to clipboard

Sometimes I want an HttpResponse and sometimes a deserialized object

Open mattiasnordqvist opened this issue 4 years ago • 3 comments

Sometimes I want an HttpResponse and sometimes a deserialized object, do I have to write another method signature then? I don't like it. What can we do?

mattiasnordqvist avatar Jan 22 '21 10:01 mattiasnordqvist

I don't mind it myself, but it seems that it can cause problems. I've came across code bases where one would use Task<HttpResponseMessage> because they did not care about the response but still assumed that the success-check was made so potentially there would be failed requests that nobody was aware of. The "correct" way to handle this in WebAnchor is to just use Task as return type, which is described in the documentation, but might not be clear enough if you're just looking at the the exposed programming api...

carl-berg avatar Jan 22 '21 11:01 carl-berg

I think we could type parameterize each and every signature, so you can, at runtime, specify what return type you want. What do you think?

mattiasnordqvist avatar Jan 25 '21 08:01 mattiasnordqvist

Maybe it is already possible?

mattiasnordqvist avatar Jan 25 '21 08:01 mattiasnordqvist