mirror of
https://github.com/Megghy/MegghysAPI.git
synced 2025-12-06 14:16:56 +08:00
21 lines
542 B
C#
21 lines
542 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace MegghysAPI.Controllers
|
|
{
|
|
[Route("api/public")]
|
|
[ApiController]
|
|
public class PublicController : MControllerBase
|
|
{
|
|
[HttpGet("header")]
|
|
public IActionResult Header(bool? order = false)
|
|
{
|
|
var headers = Request.Headers.Select(h => $"{h.Key}: {h.Value}");
|
|
if (order == true)
|
|
{
|
|
headers = headers.OrderBy(h => h);
|
|
}
|
|
return Ok(string.Join(Environment.NewLine, headers));
|
|
}
|
|
}
|
|
}
|