I have an api call that acts as a simple passthrough to another api call (for security purposes). I simply want to return the json response so I don't have to duplicate an object or create a whole ws client for one call is this possible? Here's what I got:
[Route("PreUpload")]
[HttpPost]
[Authorize]
public async Task<IHttpActionResult> PreUpload(PreUploadInfoModel model)
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(ConfigurationManager.AppSettings["FileServerURI"].ToString());
model.UserId = CurrentUserID;
var response = await client.PostAsJsonAsync("api/files/PreUpload", model);
if (response.IsSuccessStatusCode)
{
// response.Content.ReadAsStringAsync().Result = "{\"UploadId\":\"blah\",\"NextChunk\":0,\"ChunkSize\":123,\"Key\":\"someKey\",\"Token\":\"myToken\"}"
return Json(response.Content.ReadAsStringAsync().Result);
}
return BadRequest(response.ToString());
}
}
Should be simple right? But this returns this to the browser:
undefined:2.1241246524224146e+43