pusher / pusher-websocket-dotnet

Pusher Channels Client Library for .NET
MIT License
112 stars 113 forks source link

Removing extra double quotes from serialized event data #84

Closed cdauphinee closed 4 years ago

cdauphinee commented 4 years ago

This fixes a bug where the Data property of the PusherEvent is being wrapped in an extra pair of double quotes. i.e. the property would contain "{"foo":"bar"}" instead of the expected {"foo":"bar"}

We've already coerced jObject["data"] into an unformatted string earlier, so it shouldn't be necessary to specify formatting here.

damdo commented 4 years ago

Thank you @cdauphinee

damdo commented 4 years ago

I think we need a couple more changes here 1) this: https://github.com/pusher/pusher-websocket-dotnet/blob/9520df2d0bd986f6b4550e03b6b915915cbe25f8/PusherClient.Tests/AcceptanceTests/EventEmitter.cs#L67 has to change to something like:

StringAssert.AreEqualIgnoringCase("{\"stuff\":1234}", emittedEvent.Data);

2) this has to change accordingly: https://github.com/pusher/pusher-websocket-dotnet/blob/9520df2d0bd986f6b4550e03b6b915915cbe25f8/PusherClient.Tests/AcceptanceTests/EventEmitter.cs#L357 to ->

eventData["data"] = jObject["data"].ToString(); // undo any kind of deserialisation

Could you include these as well? Thank you :)

cdauphinee commented 4 years ago

:+1: Updated the test to be consistent with the new code

damdo commented 4 years ago

Great! Thank you!