Skip to content

Differentiating the type of client making a request. HTTP vs gRPC vs MQ, etc. #47

Closed Answered by mythz
techdragon asked this question in Q&A
Discussion options

You must be logged in to vote

Ok so looks like you just want to differentiate which endpoint the API was invoked on.

Firstly the Order of Operations docs explains the Request pipeline that each endpoint executes, i.e:

The first way to tell difference between them is that the IRequest context from base.Request will use a different impl per endpoint:

  • NetCoreRequest - HTTP on ASP.NET Core
  • BasicRequest - MQ
  • GrpcRequest - gRPC

So you could detect different endpoints with:

if (base.Request is GrpcRequest) {} //gRPC
else if (base.Request is BasicRequest) {} //MQ
else if (base.Request is NetCoreRequest) {} //HTTP on ASP.NET Core

Although I'd …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by techdragon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants