private ActionWrapper CreateActionRequest(string name, ParameterWrapper[] parameters, out HttpWebRequest req) { ConcurrentDictionary <string, ActionWrapper> @interface; if (!cache.TryGetValue(interfaceType, out @interface)) { throw new InvalidOperationException("Unknown interface type"); } ActionWrapper action; if ([email protected](GetActionName(name), out action)) { throw new InvalidOperationException("Unknown method"); } var path = action.RouteTemplate; List <string> queryStrings = new List <string>(); foreach (var source in parameters.Where(p => p.In == InclutionTypes.Path)) { if (path.Contains($"{{{source.Name}}}")) { path = path.Replace($"{{{source.Name}}}", source.value.ToString()); } else { queryStrings.Add($"{source.Name}={source.value}"); } } if (queryStrings.Any()) { path = path + "?" + string.Join("&", queryStrings); } req = CreateRequest(path); req.Method = action.Actions.First().ToString(); AppendHeaders(parameters, req, action); AppendBody(parameters, req); if (authenticationHandler != null) { authenticationHandler.Apply(req); } return(action); }