Skip to content

Investigate why the Host sends Json bodies as Strings in the TypedData #5

Closed
@TylerLeonhardt

Description

@TylerLeonhardt

The host is packaging the Body from the request as a String rather than Json in TypedData

image

This is the data I get from the host:

[8/24/18 2:52:08 AM] {
[8/24/18 2:52:08 AM]   "Origin": "Host",
[8/24/18 2:52:08 AM]   "MessageType": "InvocationRequest",
[8/24/18 2:52:08 AM]   "WorkerId": "cdd99528-4308-497d-8513-f201784de84a",
[8/24/18 2:52:08 AM]   "Message": {
[8/24/18 2:52:08 AM]     "RequestId": "",
[8/24/18 2:52:08 AM]     "InvocationRequest": {
[8/24/18 2:52:08 AM]       "InvocationId": "cc5d6a62-d445-49e7-ac7b-88e0f8b6cce3",
[8/24/18 2:52:08 AM]       "FunctionId": "e62e1d6b-568c-4927-aa9a-2483cbfa6096",
[8/24/18 2:52:08 AM]       "InputData": [
[8/24/18 2:52:08 AM]         {
[8/24/18 2:52:08 AM]           "Name": "req",
[8/24/18 2:52:08 AM]           "Data": {
[8/24/18 2:52:08 AM]             "String": "",
[8/24/18 2:52:08 AM]             "Json": "",
[8/24/18 2:52:08 AM]             "Bytes": [],
[8/24/18 2:52:08 AM]             "Stream": [],
[8/24/18 2:52:08 AM]             "Http": {
[8/24/18 2:52:08 AM]               "Method": "POST",
[8/24/18 2:52:08 AM]               "Url": "http://localhost:7071/api/MyHttpTrigger",
[8/24/18 2:52:08 AM]               "Headers": {
[8/24/18 2:52:08 AM]                 "content-type": "application/x-www-form-urlencoded",
[8/24/18 2:52:08 AM]                 "host": "localhost:7071",
[8/24/18 2:52:08 AM]                 "user-agent": "Mozilla/5.0 (Macintosh; Darwin 18.0.0 Darwin Kernel Version 18.0.0: Sun Aug 12 14:04:39 PDT 2018; root:xnu-4903.201.1~14/RELEASE_X86_64; en-US) PowerShell/6.1.0",
[8/24/18 2:52:08 AM]                 "content-length": "17"
[8/24/18 2:52:08 AM]               },
[8/24/18 2:52:08 AM]               "Body": {
[8/24/18 2:52:08 AM]                 "String": "{\"Name\": \"Tyler\"}",
[8/24/18 2:52:08 AM]                 "Json": "",
[8/24/18 2:52:08 AM]                 "Bytes": [],
[8/24/18 2:52:08 AM]                 "Stream": [],
[8/24/18 2:52:08 AM]                 "Int": 0,
[8/24/18 2:52:08 AM]                 "Double": 0.0,
[8/24/18 2:52:08 AM]                 "DataCase": "String"
[8/24/18 2:52:08 AM]               },
[8/24/18 2:52:08 AM]               "Params": {},
[8/24/18 2:52:08 AM]               "StatusCode": "",
[8/24/18 2:52:08 AM]               "Query": {},
[8/24/18 2:52:08 AM]               "EnableContentNegotiation": false,
[8/24/18 2:52:08 AM]               "RawBody": {
[8/24/18 2:52:08 AM]                 "String": "{\"Name\": \"Tyler\"}",
[8/24/18 2:52:08 AM]                 "Json": "",
[8/24/18 2:52:08 AM]                 "Bytes": [],
[8/24/18 2:52:08 AM]                 "Stream": [],
[8/24/18 2:52:08 AM]                 "Int": 0,
[8/24/18 2:52:08 AM]                 "Double": 0.0,
[8/24/18 2:52:08 AM]                 "DataCase": "String"
[8/24/18 2:52:08 AM]               }
[8/24/18 2:52:08 AM]             },
[8/24/18 2:52:08 AM]             "Int": 0,
[8/24/18 2:52:08 AM]             "Double": 0.0,
[8/24/18 2:52:08 AM]             "DataCase": "Http"
[8/24/18 2:52:08 AM]           }
[8/24/18 2:52:08 AM]         }
[8/24/18 2:52:08 AM]       ],
[8/24/18 2:52:08 AM]       "TriggerMetadata": {
[8/24/18 2:52:08 AM]         "$request": {
[8/24/18 2:52:08 AM]           "String": "",
[8/24/18 2:52:08 AM]           "Json": "",
[8/24/18 2:52:08 AM]           "Bytes": [],
[8/24/18 2:52:08 AM]           "Stream": [],
[8/24/18 2:52:08 AM]           "Http": {
[8/24/18 2:52:08 AM]             "Method": "POST",
[8/24/18 2:52:08 AM]             "Url": "http://localhost:7071/api/MyHttpTrigger",
[8/24/18 2:52:08 AM]             "Headers": {
[8/24/18 2:52:08 AM]               "content-type": "application/x-www-form-urlencoded",
[8/24/18 2:52:08 AM]               "host": "localhost:7071",
[8/24/18 2:52:08 AM]               "user-agent": "Mozilla/5.0 (Macintosh; Darwin 18.0.0 Darwin Kernel Version 18.0.0: Sun Aug 12 14:04:39 PDT 2018; root:xnu-4903.201.1~14/RELEASE_X86_64; en-US) PowerShell/6.1.0",
[8/24/18 2:52:08 AM]               "content-length": "17"
[8/24/18 2:52:08 AM]             },
[8/24/18 2:52:08 AM]             "Body": {
[8/24/18 2:52:08 AM]               "String": "{\"Name\": \"Tyler\"}",
[8/24/18 2:52:08 AM]               "Json": "",
[8/24/18 2:52:08 AM]               "Bytes": [],
[8/24/18 2:52:08 AM]               "Stream": [],
[8/24/18 2:52:08 AM]               "Int": 0,
[8/24/18 2:52:08 AM]               "Double": 0.0,
[8/24/18 2:52:08 AM]               "DataCase": "String"
[8/24/18 2:52:08 AM]             },
[8/24/18 2:52:08 AM]             "Params": {},
[8/24/18 2:52:08 AM]             "StatusCode": "",
[8/24/18 2:52:08 AM]             "Query": {},
[8/24/18 2:52:08 AM]             "EnableContentNegotiation": false,
[8/24/18 2:52:08 AM]             "RawBody": {
[8/24/18 2:52:08 AM]               "String": "{\"Name\": \"Tyler\"}",
[8/24/18 2:52:08 AM]               "Json": "",
[8/24/18 2:52:08 AM]               "Bytes": [],
[8/24/18 2:52:08 AM]               "Stream": [],
[8/24/18 2:52:08 AM]               "Int": 0,
[8/24/18 2:52:08 AM]               "Double": 0.0,
[8/24/18 2:52:08 AM]               "DataCase": "String"
[8/24/18 2:52:08 AM]             }
[8/24/18 2:52:08 AM]           },
[8/24/18 2:52:08 AM]           "Int": 0,
[8/24/18 2:52:08 AM]           "Double": 0.0,
[8/24/18 2:52:08 AM]           "DataCase": "Http"
[8/24/18 2:52:08 AM]         },
[8/24/18 2:52:08 AM]         "Name": {
[8/24/18 2:52:08 AM]           "String": "Tyler",
[8/24/18 2:52:08 AM]           "Json": "",
[8/24/18 2:52:08 AM]           "Bytes": [],
[8/24/18 2:52:08 AM]           "Stream": [],
[8/24/18 2:52:08 AM]           "Int": 0,
[8/24/18 2:52:08 AM]           "Double": 0.0,
[8/24/18 2:52:08 AM]           "DataCase": "String"
[8/24/18 2:52:08 AM]         },
[8/24/18 2:52:08 AM]         "Query": {
[8/24/18 2:52:08 AM]           "String": "",
[8/24/18 2:52:08 AM]           "Json": "{}",
[8/24/18 2:52:08 AM]           "Bytes": [],
[8/24/18 2:52:08 AM]           "Stream": [],
[8/24/18 2:52:08 AM]           "Int": 0,
[8/24/18 2:52:08 AM]           "Double": 0.0,
[8/24/18 2:52:08 AM]           "DataCase": "Json"
[8/24/18 2:52:08 AM]         },
[8/24/18 2:52:08 AM]         "Headers": {
[8/24/18 2:52:08 AM]           "String": "",
[8/24/18 2:52:08 AM]           "Json": "{\"Content-Type\":\"application/x-www-form-urlencoded\",\"Host\":\"localhost:7071\",\"User-Agent\":\"Mozilla/5.0 (Macintosh; Darwin 18.0.0 Darwin Kernel Version 18.0.0: Sun Aug 12 14:04:39 PDT 2018; root:xnu-4903.201.1~14/RELEASE_X86_64; en-US) PowerShell/6.1.0\",\"Content-Length\":\"17\"}",
[8/24/18 2:52:08 AM]           "Bytes": [],
[8/24/18 2:52:08 AM]           "Stream": [],
[8/24/18 2:52:08 AM]           "Int": 0,
[8/24/18 2:52:08 AM]           "Double": 0.0,
[8/24/18 2:52:08 AM]           "DataCase": "Json"
[8/24/18 2:52:08 AM]         },
[8/24/18 2:52:08 AM]         "req": {
[8/24/18 2:52:08 AM]           "String": "",
[8/24/18 2:52:08 AM]           "Json": "",
[8/24/18 2:52:08 AM]           "Bytes": [],
[8/24/18 2:52:08 AM]           "Stream": [],
[8/24/18 2:52:08 AM]           "Http": {
[8/24/18 2:52:08 AM]             "Method": "POST",
[8/24/18 2:52:08 AM]             "Url": "http://localhost:7071/api/MyHttpTrigger",
[8/24/18 2:52:08 AM]             "Headers": {
[8/24/18 2:52:08 AM]               "content-type": "application/x-www-form-urlencoded",
[8/24/18 2:52:08 AM]               "host": "localhost:7071",
[8/24/18 2:52:08 AM]               "user-agent": "Mozilla/5.0 (Macintosh; Darwin 18.0.0 Darwin Kernel Version 18.0.0: Sun Aug 12 14:04:39 PDT 2018; root:xnu-4903.201.1~14/RELEASE_X86_64; en-US) PowerShell/6.1.0",
[8/24/18 2:52:08 AM]               "content-length": "17"
[8/24/18 2:52:08 AM]             },
[8/24/18 2:52:08 AM]             "Body": {
[8/24/18 2:52:08 AM]               "String": "{\"Name\": \"Tyler\"}",
[8/24/18 2:52:08 AM]               "Json": "",
[8/24/18 2:52:08 AM]               "Bytes": [],
[8/24/18 2:52:08 AM]               "Stream": [],
[8/24/18 2:52:08 AM]               "Int": 0,
[8/24/18 2:52:08 AM]               "Double": 0.0,
[8/24/18 2:52:08 AM]               "DataCase": "String"
[8/24/18 2:52:08 AM]             },
[8/24/18 2:52:08 AM]             "Params": {},
[8/24/18 2:52:08 AM]             "StatusCode": "",
[8/24/18 2:52:08 AM]             "Query": {},
[8/24/18 2:52:08 AM]             "EnableContentNegotiation": false,
[8/24/18 2:52:08 AM]             "RawBody": {
[8/24/18 2:52:08 AM]               "String": "{\"Name\": \"Tyler\"}",
[8/24/18 2:52:08 AM]               "Json": "",
[8/24/18 2:52:08 AM]               "Bytes": [],
[8/24/18 2:52:08 AM]               "Stream": [],
[8/24/18 2:52:08 AM]               "Int": 0,
[8/24/18 2:52:08 AM]               "Double": 0.0,
[8/24/18 2:52:08 AM]               "DataCase": "String"
[8/24/18 2:52:08 AM]             }
[8/24/18 2:52:08 AM]           },
[8/24/18 2:52:08 AM]           "Int": 0,
[8/24/18 2:52:08 AM]           "Double": 0.0,
[8/24/18 2:52:08 AM]           "DataCase": "Http"
[8/24/18 2:52:08 AM]         },
[8/24/18 2:52:08 AM]         "sys": {
[8/24/18 2:52:08 AM]           "String": "",
[8/24/18 2:52:08 AM]           "Json": "{\"MethodName\":\"MyHttpTrigger\",\"UtcNow\":\"2018-08-24T02:52:08.599495Z\",\"RandGuid\":\"e514f87a-a916-4229-892d-e30e90b2dd93\"}",
[8/24/18 2:52:08 AM]           "Bytes": [],
[8/24/18 2:52:08 AM]           "Stream": [],
[8/24/18 2:52:08 AM]           "Int": 0,
[8/24/18 2:52:08 AM]           "Double": 0.0,
[8/24/18 2:52:08 AM]           "DataCase": "Json"
[8/24/18 2:52:08 AM]         }
[8/24/18 2:52:08 AM]       }
[8/24/18 2:52:08 AM]     },
[8/24/18 2:52:08 AM]     "ContentCase": "InvocationRequest"
[8/24/18 2:52:08 AM]   },
[8/24/18 2:52:08 AM]   "Name": "InvocationRequest",
[8/24/18 2:52:08 AM]   "Source": "Rpc"
[8/24/18 2:52:08 AM] }

I'm invoking the script with Invoke-WebRequest in PowerShell:

iwr http://localhost:7071/api/MyHttpTrigger -Method Post -Body '{"Name": "Tyler"}'

Is this a bug in the host or by design and I need to attempt to deserialize it?

cc @pragnagopa + @asavaritayal

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions