Investigative information
- Timestamp: 1632902318
- Function App name:
- Function name(s) (as appropriate):
- Core Tools version: 3.2.0-0 Commit hash: 5ffe001695be89a9b33cb569c875aef15938830b
Repro steps
Provide the steps required to reproduce the problem:
- Create simple function:
__init__.py
import azure.functions
def main(req: azure.functions.HttpRequest):
return str(req.params)
function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}
- Access function URL with query params
?paramwithvalue=foo¶mwithoutvalue
{"paramwithvalue": "foo"} is returned
Expected behavior
I would expect the HttpRequest.params to contain all query params, defaulting to either a value of None or an empty string:
{
"paramwithvalue": "foo",
"paramwithoutvalue": ""
}
Actual behavior
The query parameter is silently discarded:
{
"paramwithvalue": "foo"
}
Known workarounds
The query param can be retrieved via urllib.parse.parse_qs from the HttpRequest.urlobject:
__init__.py
from urllib.parse import parse_qs, urlparse
import azure.functions
def main(req: azure.functions.HttpRequest):
return str(parse_qs(urlparse(req.url).query, keep_blank_values=True))
This will return the full set of params:
"{'paramwithvalue': ['foo'], 'paramwithoutvalue': ['']}"
Contents of the requirements.txt file:
Related information
This seems to be an underlying issue in the protobuf implementation and was already fixed in Azure/azure-functions-language-worker-protobuf#49
Investigative information
Repro steps
Provide the steps required to reproduce the problem:
__init__.py
{ "scriptFile": "__init__.py", "bindings": [ { "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", "methods": [ "get", "post" ] }, { "type": "http", "direction": "out", "name": "$return" } ] }?paramwithvalue=foo¶mwithoutvalue{"paramwithvalue": "foo"}is returnedExpected behavior
I would expect the
HttpRequest.paramsto contain all query params, defaulting to either a value ofNoneor an empty string:{ "paramwithvalue": "foo", "paramwithoutvalue": "" }Actual behavior
The query parameter is silently discarded:
{ "paramwithvalue": "foo" }Known workarounds
The query param can be retrieved via
urllib.parse.parse_qsfrom theHttpRequest.urlobject:__init__.py
This will return the full set of params:
Contents of the requirements.txt file:
Related information
This seems to be an underlying issue in the protobuf implementation and was already fixed in Azure/azure-functions-language-worker-protobuf#49