Created
October 13, 2018 11:08
-
-
Save Mirch/33676445023fd31215273124cc2d1b0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<T> GetAs<T>(string path) | |
{ | |
var response = await _client.GetStringAsync(path); | |
return JsonConvert.DeserializeObject<T>(response); | |
} | |
public async Task<string> Post(string path, object content) | |
{ | |
StringContent postContent = new StringContent(JsonConvert.SerializeObject(content)); | |
var response = await _client.PostAsync(path, postContent); | |
var responseContent = await response.Content.ReadAsStringAsync(); | |
return responseContent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment