【发布时间】:2016-08-11 08:20:10
【问题描述】:
这是用于连接 Visual Studio Team Services(以前是 Visual Studio Online)和本地 TFS 的 REST API。我想设置标头以便我可以压缩我的请求,但 API 文档没有指定支持 gzip。我希望有人可能有经验。
using (var wc = new WebClient())
{
wc.Credentials = TfsCredentials;
wc.Headers[HttpRequestHeader.ContentEncoding] = "gzip";
wc.Headers[HttpRequestHeader.ContentType] = "application/json";
var gzipByteArray = GZipBytes(serializedJson);
var uploadResponse = wc.UploadData(repoUri, gzipByteArray);
return Encoding.UTF8.GetString(uploadResponse);
}
响应为 400,并带有以下错误消息:
The body of the request contains invalid Json. Parameter name: contentStream
【问题讨论】:
标签: tfs azure-devops tfs-2015