How to Intercept all Nancy requests -
i have seen post: nancy: how capture requests irrespective of verb or path , followed along on github article.
but not work. have added class in project:
public class mybootstrapper : nancy.defaultnancybootstrapper
but class never instantiated, , github documentation not discuss in detail.
what need cause bootstrapper used?
i found it. there 2 ways add items pipeline. 1 deriving bootstrap class, failed me. other implementing class honored iapplicationstartup interface. worked, , here code:
public class beforeallrequests : iapplicationstartup { public void initialize(ipipelines pipelines) { pipelines.beforerequest.additemtostartofpipeline(ctx => { if (ctx != null) { log.debug("request: " + ctx.request.url); } return null; }); } }
Comments
Post a Comment