Skip to content

Commit

Permalink
WIP: Binding a callback to multiple HTTP methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
arteymix committed May 28, 2015
1 parent e81d4d3 commit e82fe91
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/router.vala
Expand Up @@ -133,7 +133,31 @@ namespace Valum {
}

/**
* Bind a callback with a custom HTTP method and a rule.
* Bind a callback to all HTTP methods defined ina
* {@link VSGI.Router.METHODS}.
*
* @since 0.1
*/
public void all (string rule, Route.Handler cb) throws RegexError {
this.methods (Request.METHODS, rule, cb);
}

/**
* Bind a callback to a list of HTTP methods.
*
* @since 0.1
*
* @param methods methods to which the callback will be bound
* @param rule rule
*/
public void methods (string[] methods, string rule, Route.Handler cb) {
foreach (var method in methods) {
this.method (method, rule, cb);
}
}

/**
* Bind a callback with a custom method.
*
* Useful if you need to support a non-standard HTTP method, otherwise you
* should use the predefined methods.
Expand Down

0 comments on commit e82fe91

Please sign in to comment.