- Gian Luca De Bonis
- SnapDevelop
- Monday, 17 May 2021 05:28 PM UTC
My API has a method with an optional parameter, that is passed as path:
api/v1/ISV/Credits/[Channel]
It is marked as [HttpGet("{customer?}")] and is declared as:
public string Credits(string channel="")
in the WebAPI Tester, it is listed as:
And I can only call it as .../ISV/Credits/WhatsApp (passing the parameter); if I don't pass any parameter, "{channel}" is passed as parameter value.
However, I can call it correctly in PostMan (even though I would prefer using the WebAPI Tester...) with both:
The only workaround I've found to call it from WebAPI Tester is to mark the method with both [HttpGet] and [HttpGet("{channel}")]. If I mark the method as [HttpGet, Route("ISV/Credits/{channel?}")] I get the same effect: working in PostMan but not in WebAPI Tester.
Is there anything I can do to test the call properly with WebAPI Tester? (i.e.: editing the query command before pressing "Send")
Thanks,
GL
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.