question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add implicit request mapping to `@Head` when the service is mapped to `@Get`

See original GitHub issue

Many server frameworks(e.g. Spring, express) create an implicit request mapping to HEAD when there’s a request handler for GET.

The feature can be useful as client sometimes just want to check the existence of resources without receiving the whole body and almost always the handlers for @Get and @Head should be the same.

Currently, armeria needs 3 annotations to do the same thing.

@Get
@Head
@Path("/some-file")
public HttpResponse someFile(ServiceRequestContext ctx) {
    // ...
    return client.execute(RequestHeaders.of(ctx.method(), "/some-object-storage-path"));
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ks-yimcommented, Apr 24, 2022

@Parkkibum95 Thanks, it seems no one has started working on this 😆

2reactions
Parkkibum95commented, Apr 23, 2022

may i try this? 🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the Spring @RequestMapping Annotation
This annotation maps HTTP requests to handler methods of MVC and REST controllers. ... You can have multiple request mappings for a method....
Read more >
Spring 4.3+ Override Default Behavior of @RequestParam for ...
@RequestMapping methods mapped to "GET" are also implicitly mapped to "HEAD", i.e. there is no need to have "HEAD" explicitly declared.
Read more >
Spring @RequestMapping - Baeldung
In this tutorial, we'll focus on one of the main annotations in Spring MVC: @RequestMapping. Simply put, the annotation is used to map...
Read more >
Annotation Type RequestMapping - Spring
The HTTP request methods to map to, narrowing the primary mapping: GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE, TRACE. Supported at the type...
Read more >
RequestMapping without any attributes behaves as "default ...
Adding a @GetMapping or a @RequestMapping annotation on a Controller handler means that you're mapping this method as a handler and providing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found