I'm building a simple API using .NET core, and would like to send a simple .json file to the client once he reaches a certain endpoint on the API.
So far I'm having very little success, but what I currently have is the following:
public IActionResult yaddayadda(){
var filePath = "./Data/file.json";
using (var stream = new FileStream(@filePath, FileMode.Open))
{
return new FileStreamResult(stream, "application/json");
}
}
This gets me nothing. (The path for the file is correct)
Thanks!
EDIT: I've experimented with different content-types, and even though it's not the correct one, multipart/form-data allows me to download a file, but it has no extension.