olofd / react-native-signalr

Use SignalR with React Native
150 stars 61 forks source link

Fix post data for AJAX polyfill #33

Closed AdamPD closed 7 years ago

AdamPD commented 7 years ago

I am not sure the reason; however, the AJAX polyfill was only pushing through the data parameter in the POST data if present. In my case, with long polling, this was leaving out messageId which seems to be fundamental in making long polling work.

This PR uses a lightweight URL parameter encoding to push the entire POST data.

This rectified the long polling functionality in my use case. I have not tested and am not aware of the following:

  1. This may or may not fix other instances where other POST data is relied upon for correct SignalR operation.
  2. Any regression that this my cause. I do find it peculiar that only the data parameter explicitly was being passed through so do have some concerns that this was for a valid reason.