使用当前的SDK实现此目的最简单的方法是使用SearchWithHttpMessagesAsync方法。
通过采用当前代码,我们可以将其更改为:
var customHeaders = new Dictionary<string, List<string>>() { { "header1", new List<string>() { "value1" } }, { "header2", new List<string>() { "value2" } } };
var response = await client.Documents.SearchWithHttpMessagesAsync(searchText, parameters, null, customHeaders);
var headerValue1 = response.Response.Headers.GetValues("header1").Aggregate((x, y) => x + y);
var headerValue2 = response.Response.Headers.GetValues("header2").Aggregate((x, y) => x + y);
SearchResults results = response.Body;
这样,我们可以发送任何自定义标头并接收任何自定义标头。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句