HttpClient 在添加header 参数值有特殊符号 报System.FormatException

HttpClient 在添加header时,参数值有逗号时会报错

 

System.FormatException:“The format of value 'HMAC-SM3, AccessKey=TXXX,' is invalid.”

 

解决方式

 

HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Post, postUrl);

httpRequest.Headers.TryAddWithoutValidation("authorization", "HMAC-SM3, AccessKey=TXXX");

 

参考文章

http://www.voidcn.com/article/p-gdawnluc-bst.html

posted @ 2020-11-03 14:34  cn_king  阅读(1681)  评论(0编辑  收藏  举报