Exemple #1
0
 public GraphQLCallHelper(
     string url,
     ApiCallHelper apiCall,
     IReadOnlyCollection <Tuple <string, string> > defaultHeaders = null)
 {
     _url            = url;
     _apiCall        = apiCall ?? throw new ArgumentNullException(nameof(apiCall));
     _defaultHeaders = defaultHeaders;
 }
Exemple #2
0
        private async Task <AssertableHttpResponse> PostAsync(
            string requestUri,
            string value)
        {
            var stringContent = HttpClientExtensions.CreateHttpStringContent(value);

            if (_defaultHeaders != null)
            {
                foreach (var defaultHeader in _defaultHeaders)
                {
                    stringContent.Headers.Add(defaultHeader.Item1, defaultHeader.Item2);
                }
            }

            var response = await _apiCall.HttpClient.PostAsync(requestUri, stringContent);

            return(await ApiCallHelper.CreateAssertableResponseAsync(
                       response,
                       $"POST {requestUri}",
                       true,
                       _apiCall.OutputToTestLog));
        }