Why is my C# Azure Function Swagger generating a body on my get request

33 views Asked by At

I created an azure function with a get function, but when I look at the SwaggerUI for it, it is creating a Req Body for it.

Here is my function declaration:

public async Task<HttpResponseMessage> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "GetCustomersInServingAndFields")]
        HttpRequestMessage req,
        [CosmosDB(databaseName: "COSMOS:DATABASE",
                  collectionName: "COSMOS:LATCH_TRIGGER_ITEMS_CONTAINER",
                  ConnectionStringSetting = "COSMOS:CONNECTION_STRING"
        )] DocumentClient client, ILogger log)

Swagger is picking up that DocumentClient as the request body in which is an issue since Get requests can't have a body, is this because it's being passed into the Run()?

That DocumentClient is used later in the function:

enter image description here

0

There are 0 answers