private void AddShawHeaders(CTWebRequest webRequest) { // webRequest.AddHeader(ShawHttpHeaders.TransactionId, Guid.NewGuid().ToString()); // webRequest.AddHeader(ShawHttpHeaders.OriginatingUserId, HostEnvironmentInformation.UserName); // webRequest.AddHeader(ShawHttpHeaders.OriginatingIpAddress, GetIpAddress()); // webRequest.AddHeader(ShawHttpHeaders.OriginatingHostName, Dns.GetHostName()); webRequest.AddHeader(ShawHttpHeaders.OriginalModuleId, "Team City Build Configuration Tests"); }
private void TransferHeaders(CTWebRequest request, ContractTestHttpClientResponse response) { if (request.ResponseHeaders == null) return; response.Headers = new Dictionary<string, string>(request.ResponseHeaders.Count); foreach (var key in request.ResponseHeaders.AllKeys) { response.Headers.Add(key, request.ResponseHeaders[key]); } }
private void AddHeaders(CTWebRequest webRequest) { AddShawHeaders(webRequest); foreach (var key in headers.Keys) { if (headers[key] != null) webRequest.AddHeader(key, headers[key]); } }
private ContractTestHttpClientResponse ExecuteRequest( ContractTestHttpClientResponse response, string uri, string httpMethod, Action<CTWebRequest> action) { using (var webRequest = new CTWebRequest(timeOutMillionSeconds)) { try { AddHeaders(webRequest); action(webRequest); } catch (WebException ex) { ProcessWebException(ex, uri, response); } catch (Exception exception) { ProcessUnknownException(exception, response, uri); } TransferHeaders(webRequest, response); return response; } }