Open RytisLT opened 6 months ago
Thanks. I'll look at this more closely when I have some time, but I like the general idea. I'm wondering if a FlurlRequest
arg instead of FlurlCall
might be enough? It seems intuitive: "given this request, return this response". Also, I could see people wanting to do this with RespondWith(string)
and RespondWithJson(object)
too, since those are probably more commonly used than the low-level method. So we might want overloads for those.
@tmenier I've changed Func<FlurlCall, HttpContent>
to Func<IFlurlRequest, HttpContent>
and added the two overloads for string and Json. There is one caveat, to get to request body I need to call request.Content.ReadAsStringAsync().Result since I cannot await
in the non-async method. To make it proper async we would need to introduce RespondWithAsync
, this would require more changes to the code. I could take a stab at it if you want.
@tmenier would you like to see any more changes to the PR or does it look good the way it is?
@tmenier can you please have a look at the PR I really need this feature for my project. Thanks!
@tmenier any chances on getting this merged?
New features are more than just a merge. I haven't had time to work on the next sprint so you'll have to be patient or use your own fork.
Roger that. Can I help you out in any way?
Minimal change that adds
FlurlCall
toRespondWith
allowing to create response based on request parameters like body, query parameters, etc.