Comments (2)
@TWEESTY If I understand correctly, the issue is that CreateInvokeHttpClient()
stores the application ID in the BaseAddress
property of the returned HttpClient
, and that property is treated case-insensitively when it's pulled back out by the InvocationHandler
attached to the HttpClient
(because hosts are generally case-insensitive for the purpose of HTTP requests)?
But, looking at the code, the BaseAddress
appears used solely for the purpose of storing the application ID. I wonder why we would do that vs. just storing the application ID in a property of the InvocationHandler
itself, as we do DaprEndpoint
, other than it just seemed convenient at the time. That would seemingly allow application IDs with uppercase letters (which should generally be valid to Dapr).
(I'm also curious as to why the application ID is optional in CreateInvokeHttpClient()
, as the code seems to assume it's set.)
from dotnet-sdk.
@philliphoff : Yes, you understand correctly.
You're right, we should add a property AppId
to the InvocationHandler
, but we need also to set the BaseAddress
with the "AppId" (if set), else an exception will be thrown if you do this like that (ie with no hostname).
httpClient.PostAsJsonAsync($"orders", content);
And no, we can called CreateInvokeHttpClient
without the appId
parameter, there is no issue to do that. But in order to send a request, we need to pass all the URI (i.e. with the AppId
) like that :
httpClient.PostAsJsonAsync($"http://order-processor/orders", content);
If the developer called CreateInvokeHttpClient
with a non null string for appId
, then it is simple, inside the InvocationHandler
this Path = $"/v1.0/invoke/{uri.Host}/method" + uri.AbsolutePath,
should be replaced by Path = $"/v1.0/invoke/{AppId}/method" + uri.AbsolutePath,
If the developer called CreateInvokeHttpClient
with no appId
, then inside the InvocationHandler
this Path = $"/v1.0/invoke/{uri.Host}/method" + uri.AbsolutePath,
should be replaced by Path = $"/v1.0/invoke/{uri.OriginalString.GetHost()}/method" + uri.AbsolutePath,
If we don't set the AppId
when called the CreateInvokeHttpClient
, we can use the same HttpClient
for several services. It's nice.
I guess there is still one issue, how to deal if the developer changes the httpClient.BaseAddress
and the developper set appId
(when when called the CreateInvokeHttpClient
) => Maybe, the InvocationHandler
should not replace the path by AppId
if AppId
is not equal to the URI Host
(comparison no case sensitive).
Do not hesitate if you have some questions.
So, it is clear in my head, I will do a MR.
from dotnet-sdk.
Related Issues (20)
- How to use ExecuteStateTransactionAsync() HOT 3
- It is not possible to read headers sent from a RabbitMQ message HOT 3
- Unable to use EventHub or Service Bus Dapr Component HOT 1
- Update the holopin.yml to use the sdk badge HOT 2
- Unable to stream using HTTP service invocation HOT 1
- Add option to handle 'dead letters' by sending them to a dead letter queue rather than a dead leter topic HOT 2
- intermittent exceptions from WorkflowLoggingService
- AddDaprSecretStore() fails on Kubernetes HOT 1
- Regarding custom middleware to setup in the pipeline and how to create
- Regarding custom middleware to setup in the pipeline and how to create
- PublishEventAsync Blocking When Delivering Locally? HOT 7
- Cryptography Support Enhancements
- SaveBulkStateAsync does not respect DAPR_API_TOKEN
- Standardize README with shield badges HOT 8
- Dead letter subscription not working with pub sub having consumer ID specified in metadata
- Allow access to injected services during DI registration of DaprClient HOT 1
- Publish message to Kafka topic (KRaft) with Dapr C# HOT 1
- Best way to create a Dapr HttpClient with custom delegating handler? HOT 1
- [Workflow] GRPC connection to workflow runtime doesn't self-heal when app restarts
- Same application doesn't allow to process CloudEvent and raw messages HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet-sdk.