On Thu, 23 Oct 2014 13:46:06 +0200, Sönke Ludwig wrote:

Am 20.10.2014 14:52, schrieb Geod24:

If you just need to get a value from the header / query in the server, @before would be fine.
You however have to know that the function must be visible to the interface, thus it will leak in the client side. So avoid anything that's not self-contained.
In addition, it works server-side, but not client-side (meaning that you cannot send a parameter through header with the REST generator, you have to do it by hand).

Why doesn't it work on the client? I definitely think it should.

Example:
https://github.com/rejectedsoftware/vibe.d/blob/master/examples/rest/source/app.d#L398

As you guess, the parameter is send, but rewritten by UDA function (That's explicitly documented in the code: https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/web/rest.d#L533 ). So whatever you send is passed using the regular parameter passing technique (Query/Body for GET/POST, respectively), then it will be ignored, as @before will override it.

That issue can be summed up by: @before can be a great tool, but everything that's put on the interface must have a client/server (sender/receiver) meaning, and @before is only meaningful to the receiver.