Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created March 12, 2020 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/18966c960fa9b97fd7b264aa911f7420 to your computer and use it in GitHub Desktop.
Save justinyoo/18966c960fa9b97fd7b264aa911f7420 to your computer and use it in GitHub Desktop.
Building PowerApps with Naver Map API
public static class StaticMapHttpTrigger
{
[FunctionName("StaticMapHttpTrigger")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "staticmap")] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
var qs = req.QueryString.ToString();
var requestUri = $"https://naveropenapi.apigw.ntruss.com/map-static/v2/raster-cors{qs}";
var uri = new Uri(requestUri);
var content = default(byte[]);
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Referer", "http://localhost");
content = await client.GetByteArrayAsync(requestUri).ConfigureAwait(false);
}
return new FileContentResult(content, "image/png");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment