Support customized header for invoker
In many cases we need passing some params like X-UserId from web to backend in HTTP header, but current implementation of js-sdk is blocking the header.
See src/implementation/Client/HTTPClient/invoker.ts line 31-36:
if (method !== HttpMethod.GET) {
// @ts-ignore
fetchOptions.headers = {
'Content-Type': 'application/json'
};
}
So I wonder whether we can add new param named header in function invoke to support this?
Like async invoke(appId: string, methodName: string, method: HttpMethod = HttpMethod.GET, data: object = {}, header = {}): Promise<object> {}
I support this request. It is something already supported by dotnet-sdk https://github.com/dapr/dotnet-sdk/issues/396
I did a fork and implemented it. That is 6 lines of code....could submit a PR eventually.
@pnocera that's great, feel free to raise a PR. Thank you for helping out!