Internally, we have save the IsLocal result in the HttpRequestMessage's property bag. Here are where we populate them.
SelfHost: HttpSelfHostServer.ProcessRequestContext()
// Add information about whether the request is local or not
request.Properties.Add(HttpPropertyKeys.IsLocalKey, new Lazy<bool>(() => IsLocal(requestContext.RequestMessage)));
WebHost: HttpControllerHandler.ConvertRequest()
// Add information about whether the request is local or not
request.Properties.Add(HttpPropertyKeys.IsLocalKey, new Lazy<bool>(() => requestBase.IsLocal));
Here is where it is consumed:
We needed this information to figure out whether to include error details or not.
We could add an extension method on the http request message to help user figure out if the request is local or not. So user can write code like the following:
Request.IsLocal();
SelfHost: HttpSelfHostServer.ProcessRequestContext()
// Add information about whether the request is local or not
request.Properties.Add(HttpPropertyKeys.IsLocalKey, new Lazy<bool>(() => IsLocal(requestContext.RequestMessage)));
WebHost: HttpControllerHandler.ConvertRequest()
// Add information about whether the request is local or not
request.Properties.Add(HttpPropertyKeys.IsLocalKey, new Lazy<bool>(() => requestBase.IsLocal));
Here is where it is consumed:
We needed this information to figure out whether to include error details or not.
We could add an extension method on the http request message to help user figure out if the request is local or not. So user can write code like the following:
Request.IsLocal();