You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB
C#

12 months ago
using HttpClientStudy.Core.Utilities;
using Microsoft.AspNetCore.Http;
1 year ago
using Microsoft.AspNetCore.Mvc;
namespace HttpClientStudy.WebClient.Controllers
{
10 months ago
/// <summary>
/// 调用API 控制器
/// </summary>
1 year ago
[Route("api/[controller]/[action]")]
[ApiController]
public class CallApiController : ControllerBase
{
private readonly ILogger<CallApiController> _logger;
10 months ago
/// <summary>
/// 构造
/// </summary>
/// <param name="logger"></param>
1 year ago
public CallApiController(ILogger<CallApiController> logger)
{
_logger = logger;
}
10 months ago
/// <summary>
/// Ping
/// </summary>
/// <returns></returns>
1 year ago
[HttpGet]
public IActionResult Ping()
{
12 months ago
_logger.LogInformation("ping");
1 year ago
return Ok("ping");
}
10 months ago
/// <summary>
/// 异常测试
/// </summary>
/// <returns></returns>
/// <exception cref="Exception"></exception>
[HttpGet]
public IActionResult Exception()
{
throw new Exception("异常测试");
}
1 year ago
}
}