Open himanshu219 opened 5 years ago
Hi,
@himanshu219 i think it's better to use this:
var part = parts[i].match(/^\s*?([a-zA-Z0-0]+)="?(.*)"?\s*?$/);
if (part && part.length > 2) {
params[part[1]] = (part[2]).replace('"', '');
}
because with your suggestion, the group 1 and 2 can be undefined if the regex match your 2nd group
Sometimes some apis give algorithm=MD5 in the response headers without quotes which breaks the code with below traceback.
at line number 106 using the following regex fixes the issue var part = parts[i].match(/^\s?([a-zA-Z0-0]+)="(.)"\s?$|^\s?([a-zA-Z0-0]+)=(.)\s?$/);