How to use webRequestFilter and webResponseFilter in WooCommerce.NET - XiaoFaye/WooCommerce.NET GitHub Wiki
1. In you project, define filter functions:
private void RequestFilter(HttpWebRequest request)
{
request.UserAgent = "custom-user-agent";
}
private void ResponseFilter(HttpWebResponse response)
{
var total = int.Parse(response.Headers["X-WP-Total"]);
var pagecount = int.Parse(response.Headers["X-WP-TotalPages"]);
}
2. Pass filter functions in RestAPI constructor:
var api = new RestAPI("http://www.yourstore.co.nz/wp-json/wc/v2/", "<WooCommerce Key>", "<WooCommerce Secret>", requestFilter: RequestFilter, responseFilter: ResponseFilter);