xp-forge / frontend

Web frontends
1 stars 1 forks source link

Handle HEAD requests if not explicitely specified #34

Closed thekid closed 1 year ago

thekid commented 1 year ago

Currently, HEAD requests can be handled with the following workaround:

use web\frontend\{Handler, Get, Head, View};

#[Handler('/')]
class Home {

  #[Head]
  public function head() {
    $empty= View::named(null);
    $empty->context= null;
    return $empty;
  }

  #[Get]
  public function index() {
    return View::named('home');
  }
}

It would be preferrable to have this automatically handled by calling the Get-annotated method and removing its response unless explicitely specified like above.

thekid commented 1 year ago

Released in https://github.com/xp-forge/frontend/releases/tag/v4.2.0