Skip to content

Commit 24a4f4b

Browse files
[genhttp] Properly fix request methods
1 parent b72c2cd commit 24a4f4b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/Servers/GenHttpServer/Program.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@
77

88
var port = (args.Length > 0 && ushort.TryParse(args[0], out var p)) ? p : (ushort)8080;
99

10+
var rootMethods = new HashSet<FlexibleRequestMethod>
11+
{
12+
FlexibleRequestMethod.Get(RequestMethod.Get),
13+
FlexibleRequestMethod.Get(RequestMethod.Head),
14+
FlexibleRequestMethod.Get(RequestMethod.Options)
15+
};
16+
1017
var app = Inline.Create()
1118
.Post("/echo", (IRequest request) => Echo(request))
1219
.Post((Stream body) => RequestContent(body))
13-
.Any(() => StringContent());
20+
.On(() => StringContent(), rootMethods);
1421

1522
return await Host.Create()
1623
.Handler(app)

0 commit comments

Comments
 (0)