public WebServices(IResourceCatalog resourceCatalog, WebExecuteString webExecute, IAuthorizationService authorizationService) : base(resourceCatalog, authorizationService) { VerifyArgument.IsNotNull("webExecute", webExecute); _webExecute = webExecute; }
public static void ExecuteRequest(WebService service, bool throwError, out ErrorResultTO errors, WebExecuteString webExecute) { var requestHeaders = SetParameters(service.Method.Parameters, service.RequestHeaders); var headers = string.IsNullOrEmpty(requestHeaders) ? new string[0] : requestHeaders.Split(new[] { '\n', '\r', ';' }, StringSplitOptions.RemoveEmptyEntries); var requestUrl = SetParameters(service.Method.Parameters, service.RequestUrl); var requestBody = SetParameters(service.Method.Parameters, service.RequestBody); service.RequestResponse = webExecute(service.Source as WebSource, service.RequestMethod, requestUrl, requestBody, throwError, out errors, headers); if(!String.IsNullOrEmpty(service.JsonPath)) { service.ApplyPath(); } }
public WebServices(IResourceCatalog resourceCatalog, WebExecuteString webExecute) : this(resourceCatalog, webExecute, ServerAuthorizationService.Instance) { }
public WebServices(IResourceCatalog resourceCatalog, WebExecuteString webExecute, IAuthorizationService authorizationService) : base(resourceCatalog, authorizationService) { VerifyArgument.IsNotNull("webExecute", webExecute); _webExecute = webExecute; }
public WebServicesMock(IResourceCatalog resourceCatalog, WebExecuteString webExecute) : base(resourceCatalog, webExecute) { }
public WebServices(IResourceCatalog resourceCatalog, WebExecuteString webExecute) : this(resourceCatalog, webExecute, ServerAuthorizationService.Instance) { }
public static void ExecuteRequest(WebService service, bool throwError, out ErrorResultTO errors, WebExecuteString webExecute) { var headers = new List <string>(); var evaluatedHeaders = new List <INameValue>(); if (service.Headers != null) { evaluatedHeaders = service.Headers.Select(o => new NameValue(SetParameters(service.Method.Parameters, o.Name), SetParameters(service.Method.Parameters, o.Value)) as INameValue).ToList(); headers.AddRange(ToHeaderStringList(evaluatedHeaders)); } var requestUrl = SetParameters(service.Method.Parameters, service.RequestUrl); var requestBody = string.Empty; var IsClassicRequestBody = !service.IsManualChecked && !service.IsFormDataChecked && !service.IsUrlEncodedChecked; if (service.IsManualChecked || IsClassicRequestBody) { requestBody = SetParameters(service.Method.Parameters, service.RequestBody); } var formDataParameters = new List <IFormDataParameters>(); if ((service.IsFormDataChecked || service.IsUrlEncodedChecked) && service.FormDataParameters != null) { var headersHelper = new WebRequestHeadersHelper(service.Headers, evaluatedHeaders); var evaluated = headersHelper.CalculateFormDataContentType(); headers = ToHeaderStringList(evaluated.ToList()); formDataParameters.AddRange(service.FormDataParameters.Select(o => { if (o is TextParameter textParam) { textParam.Key = SetParameters(service.Method.Parameters, textParam.Key); textParam.Value = SetParameters(service.Method.Parameters, textParam.Value); return(textParam); } else if (o is FileParameter fileParam) { fileParam.Key = SetParameters(service.Method.Parameters, fileParam.Key); fileParam.FileName = SetParameters(service.Method.Parameters, fileParam.FileName); fileParam.FileBase64 = SetParameters(service.Method.Parameters, fileParam.FileBase64); return(fileParam); } return(o); }).ToList()); } var webExecuteStringArgs = new WebExecuteStringArgs { IsManualChecked = service.IsManualChecked, IsFormDataChecked = service.IsFormDataChecked, IsUrlEncodedChecked = service.IsUrlEncodedChecked, FormDataParameters = service.FormDataParameters, WebRequestFactory = null }; var webResponse = webExecute?.Invoke(service.Source as WebSource, service.RequestMethod, requestUrl, requestBody, throwError, out errors, headers.ToArray(), webExecuteStringArgs); service.RequestResponse = Scrubber.Scrub(webResponse); if (!String.IsNullOrEmpty(service.JsonPath)) { service.ApplyPath(); } errors = new ErrorResultTO(); }
public WebServicesMock(IResourceCatalog resourceCatalog, WebExecuteString webExecute) : base(resourceCatalog, webExecute) { }
public static void ExecuteRequest(WebService service, bool throwError, out ErrorResultTO errors, WebExecuteString webExecute) { var headers = new List <string>(); if (service.Headers != null) { headers.AddRange(service.Headers.Select(nameValue => nameValue.Name + ":" + SetParameters(service.Method.Parameters, nameValue.Value)).ToList()); } var requestUrl = SetParameters(service.Method.Parameters, service.RequestUrl); var requestBody = SetParameters(service.Method.Parameters, service.RequestBody); service.RequestResponse = webExecute(service.Source as WebSource, service.RequestMethod, requestUrl, requestBody, throwError, out errors, headers.ToArray()); if (!String.IsNullOrEmpty(service.JsonPath)) { service.ApplyPath(); } }
public static void ExecuteRequest(WebService service, bool throwError, out ErrorResultTO errors, WebExecuteString webExecute) { var requestHeaders = SetParameters(service.Method.Parameters, service.RequestHeaders); var headers = string.IsNullOrEmpty(requestHeaders) ? new string[0] : requestHeaders.Split(new[] { '\n', '\r', ';' }, StringSplitOptions.RemoveEmptyEntries); var requestUrl = SetParameters(service.Method.Parameters, service.RequestUrl); var requestBody = SetParameters(service.Method.Parameters, service.RequestBody); service.RequestResponse = webExecute(service.Source as WebSource, service.RequestMethod, requestUrl, requestBody, throwError, out errors, headers); if (!String.IsNullOrEmpty(service.JsonPath)) { service.ApplyPath(); } }