PowerShell Azure Functions $TriggerMetadata 方法是 GET 但应该是 POST
PowerShell Azure Functions $TriggerMetadata Methode is GET but shoud be POST
我是 Azure Functions 的新手,所以这可能很明显。
内容如下:
我有一个带 Pode 的 Powershell Azure Functions HTTP 触发函数,它有一个 GET 和一个 POST 路由。现在,当我通过 Postman、Invoke-WebRequest 或除 Azure 测试工具之外的任何其他工具发送 POST 请求时,我最终进入了 GET 路由。
我的调试显示 $TriggerMetadata
在这些情况下包含 '"Method": "GET"'。 '"Method": "POST"' 仅当请求来自 Azure 测试工具本身时。
我面临一个谜语。我希望有人能帮助我。
我的代码:
param($Request, $TriggerMetadata)
$endpoint = '/api/Object'
Write-Host "$endpoint - PowerShell HTTP trigger function processed a request."
Start-PodeServer -Request $TriggerMetadata -ServerlessType AzureFunctions {
# get route that can return data
Add-PodeRoute -Method Get -Path $endpoint -ScriptBlock {
Write-Host "$endpoint - Get"
#doing stuff
}
# post route to create some data
Add-PodeRoute -Method Post -Path $endpoint -ScriptBlock {
Write-Host "$endpoint - Post"
#doing stuff
}
}
我的function.json:
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "Request",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "Response"
}
]
}
非常抱歉,尤其是这个非常不满意,但是问题已经不存在了。
我强烈怀疑这是 Azure 中的一个错误,因为我没有更改任何内容,一切又恢复正常了。
我猜是时候检查 Azure Functions SLA 了。
我是 Azure Functions 的新手,所以这可能很明显。
内容如下:
我有一个带 Pode 的 Powershell Azure Functions HTTP 触发函数,它有一个 GET 和一个 POST 路由。现在,当我通过 Postman、Invoke-WebRequest 或除 Azure 测试工具之外的任何其他工具发送 POST 请求时,我最终进入了 GET 路由。
我的调试显示 $TriggerMetadata
在这些情况下包含 '"Method": "GET"'。 '"Method": "POST"' 仅当请求来自 Azure 测试工具本身时。
我面临一个谜语。我希望有人能帮助我。
我的代码:
param($Request, $TriggerMetadata)
$endpoint = '/api/Object'
Write-Host "$endpoint - PowerShell HTTP trigger function processed a request."
Start-PodeServer -Request $TriggerMetadata -ServerlessType AzureFunctions {
# get route that can return data
Add-PodeRoute -Method Get -Path $endpoint -ScriptBlock {
Write-Host "$endpoint - Get"
#doing stuff
}
# post route to create some data
Add-PodeRoute -Method Post -Path $endpoint -ScriptBlock {
Write-Host "$endpoint - Post"
#doing stuff
}
}
我的function.json:
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "Request",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "Response"
}
]
}
非常抱歉,尤其是这个非常不满意,但是问题已经不存在了。
我强烈怀疑这是 Azure 中的一个错误,因为我没有更改任何内容,一切又恢复正常了。
我猜是时候检查 Azure Functions SLA 了。