Please provide the following:
N/A - this issue is reproducible locally.
Provide the steps required to reproduce the problem:
Run the following Typescript function:
import { AzureFunction, Context, HttpRequest } from "@azure/functions" const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> { context.res = { body:context.bindingData } }
With the following function.json
{ "bindings": [ { "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", "route": "periods/{id}", "methods": [ "get" ] }, { "type": "http", "direction": "out", "name": "res" } ], "scriptFile": "../dist/TestFunc/index.js" }
Run func start
Hit the URL with 0 as the parameter:
curl <function-url>/api/periods/0
Output is:
{ "invocationId": <hash>, "id": { "string": "0", "data": "string" }, .... }
Hit the URL with 1 as the parameter
curl <function-url>/api/periods/1
Output is:
{ "invocationId": <hash>, "id": 1 ... }Expected behavior
Format should be the same no matter what value is passed in.
Actual behaviorFormat is integer literal for non-zero values (id: 1
) and an object ({ ... }
) for zero values.
You can detect and respond in code, but that is ugly.
Related informationProvide any related information
import { AzureFunction, Context, HttpRequest } from "@azure/functions" const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> { context.res = { body:context.bindingData } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4