manywho / ui-bootstrap

5 stars 3 forks source link

FLOW-1904 - Using responseJSON for errors if they are strings to remove unnecessary quotes #172

Closed TomFullalove closed 3 years ago

TomFullalove commented 3 years ago

jQuery fulfils responseJSON because we are always passing dataType of 'json' with all of our request (can be seen in ui-core connection.ts request function). see https://api.jquery.com/jquery.ajax/#data-types for more info on responseJSON.

For errors, responseJSON should just resolve to a string, with the extra quotes parsed for us by jQuery. For cases this doesn't work, we use responseText to ensure we always show a string.