Better HN
topnewbestaskshowjobs
Log inSign up

missingencoding

2 karma · joined Jun 4, 2017 (9y ago) · 2 submissions

Submissions

comment 9y ago · link · parent

better safe than sorry, as I'm sure you know ;)

comment 9y ago · link · parent

Hey homakov, nice work. might want to remember to encodeURIComponent() around the keys as well:

     SecureLogin = function(scope){
       function toQuery(obj){
         return Object.keys(obj).reduce(function(a,k){a.push(k+'='+encodeURIComponent(obj[k]));return a},[]).join('&')