Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CarterOptions() before lambda expression on 5.1.0 #253

Closed
heitor481 opened this issue Jul 2, 2020 · 2 comments
Closed

CarterOptions() before lambda expression on 5.1.0 #253

heitor481 opened this issue Jul 2, 2020 · 2 comments

Comments

@heitor481
Copy link

Hi all

On previous carter version, we had the possibility to, inside the Configure method of Startup.cs create a lambda expression inside the app.UserCarter() to inject something on the header response of every call to our api.

So basically the call was something like that:

public void Configure(IApplicationBuilder app, IHostingEnvironment env) 
{
   app.UseCarter(new CarterOptions(before: ctx => Inject(ctx)))
}

private Task<bool> Inject(HttpContext ctx) 
{
   ctx.Response.Headers["our-api-header"] = ((int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString();
 return Task.FromResult(true);
}

This is something that was possible on old version of carter. But, on the new one, I didn't see any option like that. So, my question is: is that something like that on Carter 5.1.0? Or it was removed?

Thanks in advanced

@jchannon
Copy link
Member

jchannon commented Jul 2, 2020 via email

@heitor481
Copy link
Author

Got it John!

Thanks a lot for the clarification about that issue.

I'm closing this thread.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants