Client side method names should be case insensitive
This commit is contained in:
parent
2cc72d72cd
commit
b4c61b6c2d
|
|
@ -75,7 +75,7 @@ export class HubConnection {
|
|||
}
|
||||
|
||||
private invokeClientMethod(invocationMessage: InvocationMessage) {
|
||||
let method = this.methods.get(invocationMessage.target);
|
||||
let method = this.methods.get(invocationMessage.target.toLowerCase());
|
||||
if (method) {
|
||||
method.apply(this, invocationMessage.arguments);
|
||||
if (!invocationMessage.nonblocking) {
|
||||
|
|
@ -202,7 +202,7 @@ export class HubConnection {
|
|||
}
|
||||
|
||||
on(methodName: string, method: (...args: any[]) => void) {
|
||||
this.methods.set(methodName, method);
|
||||
this.methods.set(methodName.toLowerCase(), method);
|
||||
}
|
||||
|
||||
set onClosed(callback: ConnectionClosed) {
|
||||
|
|
|
|||
|
|
@ -136,7 +136,12 @@ describe('hubConnection', function () {
|
|||
|
||||
var message = "你好 SignalR!";
|
||||
|
||||
hubConnection.on("Message", function (msg) {
|
||||
// client side method names are case insensitive
|
||||
var methodName = 'message';
|
||||
var idx = Math.floor(Math.random() * (methodName.length - 1));
|
||||
methodName = methodName.substr(0, idx) + methodName[idx].toUpperCase() + methodName.substr(idx + 1);
|
||||
|
||||
hubConnection.on(methodName, function (msg) {
|
||||
expect(msg).toBe(message);
|
||||
done();
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue