Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HEAD and OPTIONS methods #67

Closed
5 of 9 tasks
Atulin opened this issue Jul 27, 2024 · 0 comments · Fixed by #74
Closed
5 of 9 tasks

Support HEAD and OPTIONS methods #67

Atulin opened this issue Jul 27, 2024 · 0 comments · Fixed by #74

Comments

@Atulin
Copy link

Atulin commented Jul 27, 2024

Immediate.Apis does not support all HTTP request methods, that is:

  • GET
  • POST
  • DELETE
  • PATCH
  • PUT
  • OPTIONS
  • HEAD
  • CONNECT
  • TRACE

Minimal APIs handle the less-commonly used ones (OPTIONS, HEAD, CONNECT, TRACE) as well as the proposed QUERY method and any custom method a user might want to handle via the MapMethods() extension method like so:

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

// OPTIONS: /foo
// HEAD: /foo
app.MapMethods("/foo", [ "OPTIONS", "HEAD" ], () => "Options or head");

// TRACE: /bar
app.MapMethods("/bar", [ "TRACE" ], (Data data) => $"Received {data.Name}");

app.Run();

so it would be nice to have an attribute that can replicate this functionality, for example

[Handler]
[MapMethods("ping", [ "HEAD" ])]
public static partial class HeadHandler
{
    // ...
}
@viceroypenguin viceroypenguin linked a pull request Jul 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants