public T BindToHeaders <T>() { var data = _dictionary.DataFor(RequestDataSource.Header.ToString()); var bindResult = _resolver.BindModel(typeof(T), data); bindResult.AssertNoProblems(typeof(T)); return((T)bindResult.Value); }
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 static string FindPath(AggregateDictionary dictionary) { var routeData = dictionary.DataFor(RequestDataSource.Route.ToString()); var list = new List <string>(); for (var i = 0; i < 10; i++) { routeData.Value("Part" + i, o => list.Add(o.ToString())); } return(list.Join("/")); }