{"action":"opened","issue":{"url":"https://api.github.com/repos/XiaoFaye/WooCommerce.NET/issues/63","repository_url":"https://api.github.com/repos/XiaoFaye/WooCommerce.NET","labels_url":"https://api.github.com/repos/XiaoFaye/WooCommerce.NET/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/XiaoFaye/WooCommerce.NET/issues/63/comments","events_url":"https://api.github.com/repos/XiaoFaye/WooCommerce.NET/issues/63/events","html_url":"https://github.com/XiaoFaye/WooCommerce.NET/issues/63","id":193470145,"number":63,"title":"Null User-Agent header gives error 403 Forbidden","user":{"login":"goguvi","id":829427,"avatar_url":"https://avatars.githubusercontent.com/u/829427?v=3","gravatar_id":"","url":"https://api.github.com/users/goguvi","html_url":"https://github.com/goguvi","followers_url":"https://api.github.com/users/goguvi/followers","following_url":"https://api.github.com/users/goguvi/following{/other_user}","gists_url":"https://api.github.com/users/goguvi/gists{/gist_id}","starred_url":"https://api.github.com/users/goguvi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goguvi/subscriptions","organizations_url":"https://api.github.com/users/goguvi/orgs","repos_url":"https://api.github.com/users/goguvi/repos","events_url":"https://api.github.com/users/goguvi/events{/privacy}","received_events_url":"https://api.github.com/users/goguvi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-05T11:14:39Z","updated_at":"2016-12-05T11:14:39Z","closed_at":null,"body":"Wordpress version: 4.6.1\r\nWooCommerce version: 2.6.8\r\nWooCommerce.NET version: 0.5.3\r\n\r\nI'm trying the code on the Readme.md to retrieve products:\r\n```\r\n     RestAPI rest = new RestAPI(ApiWoo, ComsumerKey, SecretKey);\r\n     WCObject wc = new WCObject(rest);\r\n     //Get all products\r\n     var products = await wc.GetProducts();\r\n```\r\n I get the http error code 403.\r\nI found that the problem is that the HTTP Header User-Agent is null at RestAPI/SendHttpClientRequest.\r\n\r\nI manage to get it to work using the following method to establish a UserAgent after the HttpWebRequest was created:\r\n```\r\n        public void SetHeader(HttpWebRequest Request, string Header, string Value)\r\n        {\r\n            PropertyInfo PropertyInfo = Request.GetType().GetRuntimeProperty(Header.Replace(\"-\", string.Empty));\r\n            if (PropertyInfo != null)\r\n            {\r\n                PropertyInfo.SetValue(Request, Value, null);\r\n            }\r\n            else\r\n            {\r\n                Request.Headers[Header] = Value;\r\n            }\r\n        }\r\n```\r\n\r\nAm I doing something wrong? Are there any workaround?\r\n\r\nI tried to use the version 0.6.0 but it gives me an error becose BatchObject is not detected.\r\nIt also gives me an error at the SendHttpClientRequest Exception becouse it says that await shouldn't be used on catch body:` throw new Exception(await GetStreamContent(we.Response.GetResponseStream(), we.Response.ContentType.Split('=')[1]));`\r\n"}}
{"actor":{"display_login":"goguvi"}}