public async Task Invoke(HttpContext context, GetWeatherHttpClient customHttpClient)
        {
            var weatherJson = await customHttpClient.GetLocationWeatherInfo();

            context.Response.ContentType = "application/json;utf-8";
            await context.Response.WriteAsync(weatherJson);   // 输出天气json

            //await this._next(context);
        }
 /// <summary>
 /// 可注入其它服务,以获取外部配置
 /// </summary>
 public ConfigureWeatherOptions(GetWeatherHttpClient customHttpClient)
 {
     this._customHttpClient = customHttpClient;
 }
Ejemplo n.º 3
0
 public WeatherViewComponent(GetWeatherHttpClient httpClient)
 {
     this._weatherHttpClient = httpClient;
 }
 public GetWeatherHttpClientJob(ILogger <GetWeatherHttpClientJob> logger, GetWeatherHttpClient client)
 {
     this._client = client;
     this._logger = logger;
 }