());
+ }
+
+ [Fact]
+ public void Process_DoesNotAddHeadersAttribute_WhenNoHeaderAttributes()
+ {
+ // Act
+ _tagHelper.Process(_context, _output);
+
+ // Assert
+ Assert.False(_output.Attributes.TryGetAttribute("hx-headers", out _));
+ }
+ }
+
+}
diff --git a/test/Sample/Pages/Headers.cshtml b/test/Sample/Pages/Headers.cshtml
new file mode 100644
index 0000000..046cc76
--- /dev/null
+++ b/test/Sample/Pages/Headers.cshtml
@@ -0,0 +1,63 @@
+@page
+@using Microsoft.AspNetCore.Antiforgery;
+@inject IAntiforgery antiforgery;
+@model HxRequestsModel
+
+
+
+
+
+
+
+
+
+
+ Testing: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
+
+
+
+
+
+ requestConfig.headers
+
+
+
+@section Scripts {
+
+}
+
diff --git a/test/Sample/Pages/Headers.cshtml.cs b/test/Sample/Pages/Headers.cshtml.cs
new file mode 100644
index 0000000..a2d3048
--- /dev/null
+++ b/test/Sample/Pages/Headers.cshtml.cs
@@ -0,0 +1,20 @@
+using Htmx;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using System.Text.Json;
+
+namespace Sample.Pages
+{
+ [ValidateAntiForgeryToken]
+ public class HxRequestsModel : PageModel
+ {
+ public IActionResult OnPost()
+ {
+ // list of headers
+ var headers = Request.Headers.ToList();
+ var html = "" + JsonSerializer.Serialize(headers, new JsonSerializerOptions { WriteIndented = true }) + "
";
+
+ return Content(html, "text/html");
+ }
+ }
+}
diff --git a/test/Sample/Pages/Shared/_Layout.cshtml b/test/Sample/Pages/Shared/_Layout.cshtml
index f1fa0ef..a0d157e 100644
--- a/test/Sample/Pages/Shared/_Layout.cshtml
+++ b/test/Sample/Pages/Shared/_Layout.cshtml
@@ -37,6 +37,9 @@
Response.Htmx()
+
+ hx-headers
+
Privacy