public HttpRequestData get_request_data() { return(new HttpRequestData { FullUrl = _request.FullUrl(), HttpMethod = _request.HttpMethod(), RawUrl = _request.RawUrl(), RelativeUrl = _request.RelativeUrl() }); }
public void RecordFormData() { try { // TODO -- Be nice to have better stuff in FubuCore var requestData = _dictionary.DataFor(RequestDataSource.Request.ToString()); requestData.GetKeys().ToList().Each(key => FormData.Add(key, requestData.Value(key))); var requestData2 = _dictionary.DataFor(RequestDataSource.Header.ToString()); requestData2.GetKeys().ToList().Each(key => Headers.Add(key, (requestData2.Value(key) ?? string.Empty).ToString())); Url = _request.RawUrl(); HttpMethod = _request.HttpMethod(); } catch (HttpException) { //Just needs to be here so we can do assert configuration is valid. } }
public RequestLog BuildForCurrentRequest() { var report = new ValueReport(); _requestData.WriteReport(report); var chainId = _currentChain.OriginatingChain == null ? Guid.Empty : _currentChain.OriginatingChain.UniqueId; var log = new RequestLog { ChainId = chainId, Time = _systemTime.UtcNow(), RequestData = report, ChainUrl = _urls.UrlFor(new ChainRequest { Id = chainId }), DetailsUrl = _urls.UrlFor(new ChainDetailsRequest { Id = chainId }) }; if (_currentChain.OriginatingChain.Route != null) { log.HttpMethod = _request.HttpMethod(); log.Endpoint = _request.RelativeUrl(); } else if (_currentChain.OriginatingChain.InputType() != null) { log.Endpoint = _currentChain.OriginatingChain.InputType().FullName; log.HttpMethod = "n/a"; } else { log.Endpoint = ChainVisualization.TitleForChain(_currentChain.OriginatingChain); log.HttpMethod = "n/a"; } log.ReportUrl = _urls.UrlFor(log); return(log); }
public static HttpMethod GetMethod(this ICurrentHttpRequest request) { return(request.HttpMethod().ToHttpMethod()); }
/// <summary> /// Is the currrent request an Http PUT? /// </summary> /// <param name="request"></param> /// <returns></returns> public static bool IsPut(this ICurrentHttpRequest request) { return(request.HttpMethod().EqualsIgnoreCase("PUT")); }
/// <summary> /// Is the current request an Http HEAD? /// </summary> /// <param name="request"></param> /// <returns></returns> public static bool IsHead(this ICurrentHttpRequest request) { return(request.HttpMethod().EqualsIgnoreCase("HEAD")); }
/// <summary> /// The current request matches one of these HTTP methods /// </summary> /// <param name="request"></param> /// <param name="httpMethods"></param> /// <returns></returns> public static bool HttpMethodMatchesAny(this ICurrentHttpRequest request, params string[] httpMethods) { return(httpMethods.Any(x => x.EqualsIgnoreCase(request.HttpMethod()))); }