jbeuckm / drupal-client

Javascript client for Drupal Services
32 stars 10 forks source link

getCsrfToken does not correctly detect empty X-CSRF-Token #22

Open adaptive-webdev opened 9 years ago

adaptive-webdev commented 9 years ago

existingToken can be a string 'null' (not empty). Therefore, the if (existingToken) statement is evaluated as true when existingToken is a string 'null'. A possible fix is changing the if statement to if ((existingToken) && ('null' != existingToken)).

pvandrunen commented 9 years ago

I second this! I learned this the very hard way, it is a problem on existingToken as well as within the systemConnect function. It will cause the application to rapidly make requests that fail over and over.

clowNay commented 9 years ago

adaptive, where should i add that check?