private static Hashtable getResponse(Session oS, bool bUseV1dot2Format) { return(new Hashtable { { "status", oS.get_responseCode() }, { "statusText", Utilities.TrimBefore(oS.oResponse.get_headers().HTTPResponseStatus, ' ') }, { "httpVersion", oS.oResponse.get_headers().HTTPVersion }, { "headersSize", oS.oResponse.get_headers().ByteCount() + 2 }, { "redirectURL", oS.oResponse.get_headers().get_Item("Location") }, { "bodySize", (oS.responseBodyBytes == null) ? 0 : oS.responseBodyBytes.Length }, { "headers", HTTPArchiveJSONExport.getHeadersAsArrayList(oS.oResponse.get_headers()) }, { "cookies", HTTPArchiveJSONExport.getCookies(oS.oResponse.get_headers()) }, { "content", HTTPArchiveJSONExport.getBodyInfo(oS, bUseV1dot2Format) } }); }
private static Hashtable getRequest(Session oS) { Hashtable hashtable = new Hashtable(); hashtable.Add("method", oS.oRequest.get_headers().HTTPMethod); hashtable.Add("url", oS.get_fullUrl()); hashtable.Add("httpVersion", oS.oRequest.get_headers().HTTPVersion); hashtable.Add("headersSize", oS.oRequest.get_headers().ByteCount() + 2); hashtable.Add("bodySize", oS.requestBodyBytes.Length); hashtable.Add("headers", HTTPArchiveJSONExport.getHeadersAsArrayList(oS.oRequest.get_headers())); hashtable.Add("cookies", HTTPArchiveJSONExport.getCookies(oS.oRequest.get_headers())); hashtable.Add("queryString", HTTPArchiveJSONExport.getQueryString(oS.get_fullUrl())); if (oS.requestBodyBytes != null && oS.requestBodyBytes.Length > 0) { hashtable.Add("postData", HTTPArchiveJSONExport.getPostData(oS)); } return(hashtable); }