private async Task MakeRequest(string compressionMethod)
        {
            var jsonPayload = JsonConvert.SerializeObject(_payload);

            using (var httpContent = new StringContent(jsonPayload, Encoding.UTF8, "application/json"))
                using (var compressedContent = new CompressedContent(httpContent, compressionMethod))
                {
                    var client         = GetClient();
                    var requestMessage = new HttpRequestMessage(HttpMethod.Post, GetUrl())
                    {
                        Content = compressedContent
                    };
                    _response = await client.SendAsync(requestMessage);

                    if (_response.IsSuccessStatusCode)
                    {
                        var responseString = await _response.Content.ReadAsStringAsync();

                        _deserializedResponse = JsonConvert.DeserializeObject <ModelWithoutRequirement>(responseString);
                    }
                }
        }
コード例 #2
0
 public IActionResult Model([FromBody] ModelWithoutRequirement model)
 {
     return(Ok(model));
 }