如何通过 azure SDK for .net 在 Azure Data Factory web activity 中设置 header
How to set header in Azure Data Factory web activity by azure SDK for .net
我只是想知道如何将 header 添加到 Azure 数据工厂网站 activity。我尝试了以下代码:
new WebActivity()
{
Name = "Authenticating",
Url = "xxxxxxxxxxxxx",
Method = "POST",
Headers = " \"Content-Type\": \"application/x-www-form-urlencoded\""
},
但是,代码将导致
"headers": {
"0": " ",
"1": "\"",
"2": "C",
"3": "o",
"4": "n",
"5": "t",
"6": "e",
"7": "n",
"8": "t",
"9": "-",
"10": "T",
"11": "y",
"12": "p",
"13": "e",
"51": "\"",
"seed": 1840253349
},
我去看了他们的源码,他们说
/// Gets or sets represents the headers that will be sent to the
/// request. For example, to set the language and type on a request:
/// "headers" : { "Accept-Language": "en-us", "Content-Type":
/// "application/json" }. Type: string (or Expression with resultType
/// string).
我还尝试在字符串中使用 {},例如:
Headers = " { \"Accept-Language\": \"en-us\", \"Content-Type\":\r\n/// \"application/json\" }",
有什么想法吗?
我们应该传入一个 Json 对象而不是字符串。只需将代码更改为以下即可。
Headers =JObject.Parse(@"{ 'Content-Type': 'application/x-www-form-urlencoded'}")
我只是想知道如何将 header 添加到 Azure 数据工厂网站 activity。我尝试了以下代码:
new WebActivity()
{
Name = "Authenticating",
Url = "xxxxxxxxxxxxx",
Method = "POST",
Headers = " \"Content-Type\": \"application/x-www-form-urlencoded\""
},
但是,代码将导致
"headers": {
"0": " ",
"1": "\"",
"2": "C",
"3": "o",
"4": "n",
"5": "t",
"6": "e",
"7": "n",
"8": "t",
"9": "-",
"10": "T",
"11": "y",
"12": "p",
"13": "e",
"51": "\"",
"seed": 1840253349
},
我去看了他们的源码,他们说
/// Gets or sets represents the headers that will be sent to the
/// request. For example, to set the language and type on a request:
/// "headers" : { "Accept-Language": "en-us", "Content-Type":
/// "application/json" }. Type: string (or Expression with resultType
/// string).
我还尝试在字符串中使用 {},例如:
Headers = " { \"Accept-Language\": \"en-us\", \"Content-Type\":\r\n/// \"application/json\" }",
有什么想法吗?
我们应该传入一个 Json 对象而不是字符串。只需将代码更改为以下即可。
Headers =JObject.Parse(@"{ 'Content-Type': 'application/x-www-form-urlencoded'}")