public static BrewRequest CreateServiceApplicationRequestFromHttpRequest(HttpRequest request) { var result = new BrewRequest { Method = request.HttpMethod, Url = request.Url, QueryString = request.Url.Query.AsQueryDictionary(), Body = request.InputStream.ToByteArray(), Headers = new BrewRequestHeaders(request.Headers.ToDictionary2()), UserHostAddress = request.UserHostAddress }; return(result); }
public BaristaContext(BrewRequest request, BrewResponse response) : this() { if (request == null) { throw new ArgumentNullException("request"); } if (response == null) { response = new BrewResponse(); } Request = request; Response = response; }
public static BrewRequest CreateBrewRequestFromIncomingWebRequest(IncomingWebRequestContext webRequest, Stream requestBody, OperationContext context) { string ip = null; object remoteEndpointProperty; if (OperationContext.Current.IncomingMessageProperties.TryGetValue(RemoteEndpointMessageProperty.Name, out remoteEndpointProperty)) { ip = ((RemoteEndpointMessageProperty)remoteEndpointProperty).Address; } var request = new BrewRequest { Method = webRequest.Method, Url = webRequest.UriTemplateMatch.RequestUri, QueryString = webRequest.UriTemplateMatch.RequestUri.Query.AsQueryDictionary(), Body = requestBody.ToByteArray(), Headers = new BrewRequestHeaders(webRequest.Headers.ToDictionary2()), UserHostAddress = ip }; return(request); }