Skip to content

Commit 1e4a7af

Browse files
Remove HTTP Verb from Invoke method
Signed-off-by: Xavier Geerinck <[email protected]>
1 parent 970f260 commit 1e4a7af

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/actors/client/ActorClient/ActorClientGRPC.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default class ActorClientGRPC implements IClientActor {
1616
this.client = client;
1717
}
1818

19-
async invoke(method: "GET" | "POST" | "PUT" | "DELETE", actorType: string, actorId: string, methodName: string, body?: any): Promise<object> {
19+
async invoke(actorType: string, actorId: string, methodName: string, body?: any): Promise<object> {
2020
const msgService = new InvokeActorRequest();
2121
msgService.setActorId(actorId)
2222
msgService.setActorType(actorType);

src/actors/client/ActorClient/ActorClientHTTP.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export default class ActorClientHTTP implements IClientActor {
1313
this.client = client;
1414
}
1515

16-
async invoke(method: "GET" | "POST" | "PUT" | "DELETE" = "POST", actorType: string, actorId: string, methodName: string, body?: any): Promise<object> {
16+
async invoke(actorType: string, actorId: string, methodName: string, body?: any): Promise<object> {
1717
const result = await this.client.execute(`/actors/${actorType}/${actorId}/method/${methodName}`, {
18-
method,
18+
method: "POST", // we always use POST calls for Invoking (ref: https://github.com/dapr/js-sdk/pull/137#discussion_r772636068)
1919
body
2020
});
2121

src/actors/client/ActorProxyBuilder.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ export default class ActorProxyBuilder<T> {
2121
const handler = {
2222
get(target: any, propKey: any, receiver: any) {
2323
return async function (...args: any) {
24-
const method: "GET" | "PUT" = args.length > 0 ? "PUT" : "GET";
2524
const body = args.length > 0 ? args : null;
26-
const res = await actorClient.actor.invoke(method, actorTypeClassName, actorId.getId(), propKey, body);
25+
const res = await actorClient.actor.invoke(actorTypeClassName, actorId.getId(), propKey, body);
2726

2827
return res;
2928
};

src/interfaces/Client/IClientActor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { KeyValueType } from "../../types/KeyValue.type";
44
import { OperationType } from "../../types/Operation.type";
55

66
export default interface IClientActor {
7-
invoke(method: "GET" | "POST" | "PUT" | "DELETE", actorType: string, actorId: string, methodName: string, body?: any): Promise<object>;
7+
invoke(actorType: string, actorId: string, methodName: string, body?: any): Promise<object>;
88
stateTransaction(actorType: string, actorId: string, operations: OperationType[]): Promise<void>;
99
stateGet(actorType: string, actorId: string, key: string): Promise<KeyValueType | string>;
1010
registerActorReminder(actorType: string, actorId: string, name: string, reminder: ActorReminderType): Promise<void>;

0 commit comments

Comments
 (0)