c# httpclient post json stringcontent
private static async Task PostBasicAsync(object content, CancellationToken cancellationToken)
{
using (var client = new HttpClient())
using (var request = new HttpRequestMessage(HttpMethod.Post, Url))
{
var json = JsonConvert.SerializeObject(content);
using (var stringContent = new StringContent(json, Encoding.UTF8, "application/json"))
{
request.Content = stringContent;
using (var response = await client
.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken)
.ConfigureAwait(false))
{
response.EnsureSuccessStatusCode();
}
}
}
}
Also in JavaScript:
- can filter be used on objects in javascript
- jquery change text of div
- random text generator javascript
- auto generate component angular
- javascript filter array of objects
- json load
- Error: It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.
- fetch
- how to append object in array javascript
- react pass parameter to component
- nohup run nodejs
- how to select class in jquery
- find method javascript
- Material-ui add circle icon
- how to display first value of an array in jquery
- array sort
- falsy values javascript
- how get checkbox if checked in jquery
- sequelize include only
- convert array string to number
- JS glob to regex
- exceljs read file
- javascript muuttujan määrittely
- javascript find matching elements in two arrays