/// <summary> /// Package typed document /// </summary> /// <typeparam name="T">Type of document body</typeparam> /// <param name="request"></param> /// <param name="response"></param> /// <returns></returns> protected IDocument <T> PackageAndAddDocument <T>(IRestRequest request, IRestResponse <T> response) { Uri requestUri = _restClient.BaseUrl; HtmlParser parser = new HtmlParser(); IHtmlDocument htmlDocument = parser.ParseDocument(response.Content); IDocument <T> document = new Document <T>(request, response, htmlDocument); if (JavascriptScrapingEnabled) { JavascriptEngine.Add(document); } if (StyleScrapingEnabled) { StyleEngine.Add(document); } document.RequestUri = requestUri; Documents.Add(document); return(document); }