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#

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