The code of the Run
method of my Azure Function is this:
public static void Run([HttpTrigger("get")] HttpRequest req, ILogger log) {
string parameter = req.Query["parameter"];
if (string.IsNullOrEmpty(parameter)) {
throw new ArgumentNullException("Parameter must be set.");
}
log.LogInformation(parameter);
}
I have the following cases when running the Function and passing the parameter to the HTTP request:
- HTTP GET without parameter (
/api/ServiceBusOutput
): exception (correct) - HTTP GET with not set parameter (
/api/ServiceBusOutput?parameter
): exception (correct) - HTTP GET with parameter as empty string (
/api/ServiceBusOutput?parameter=""
): success but it should fail (the URL becomes/api/ServiceBusOutput?parameter=%22%22
) - HTTP GET with parameter as string (
/api/ServiceBusOutput?parameter="something"
): success (correct)
How can I do to make the third test to fail?