Reputation: 1109
This is the REST API used to connect with Visual Studio Team Services (was Visual Studio Online), and on-premise TFS. I would like to set the headers so I can compress my requests, but the API documentation does not specify that gzip is supported. I'm hoping somebody might have experience.
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);
}
Response is a 400, with the following error message:
The body of the request contains invalid Json. Parameter name: contentStream
Upvotes: 0
Views: 459
Reputation: 29966
I cannot find any documentation about this either. But I tested it with and without gzip compress from curl. The size of response is indeed compressed with gzip and the response can be decompressed correctly. So it should be supported.
Upvotes: 1