0

In Program.cs I can use

app.Environment.IsDevelopment()

Now I have a custom HttpRequestInterceptor : DefaultHttpRequestInterceptor with a method

public override ValueTask OnCreateAsync(HttpContext context,
IRequestExecutor requestExecutor, IQueryRequestBuilder requestBuilder,
CancellationToken cancellationToken)

How can I get access to app.Environment.IsDevelopment() in that method? (I want to set some kind of faked authentication during development)

stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270

1 Answers1

1

You can inject the IWebHostEnvironment through the constructor of the HttpRequestInterceptor and perform your IsDevelopment check on that injected instance.

Tobias Tengler
  • 6,848
  • 4
  • 20
  • 34