On Sun, 26 Apr 2015 19:49:22 GMT, Dato wrote:
I've been looking for this quite a time. I'd not open a thread for this dumb question but I couldn't find appropriate documentation. I found that @before annotation should be used, but I've got no idea how... So I have the following interface
...
@rootPathFromName
public interface ITroy
{@path("/test") string getTest();
}
...with proper implementation. However, I've got no idea how to access headers from getTest method.
Thanks
Depends on what you want to do. If you want read-only access to the headers, you could use @headerParam
(example here: https://github.com/rejectedsoftware/vibe.d/blob/4bd0cbb1b4eb51051f7f7886e54c6f2c6b4541e1/examples/rest/source/app.d#L349 ).
If you want to write to them, that's a bit more problematic. ATM there is no perfect solution. One way to do it is to use @after
https://github.com/rejectedsoftware/vibe.d/blob/4bd0cbb1b4eb51051f7f7886e54c6f2c6b4541e1/examples/rest/source/app.d#L289 , however, bear in mind it has to be trivial since it will leak on the client side.