Skip to content

Commit

Permalink
Add a special case exceptions (PolymerElements#207)
Browse files Browse the repository at this point in the history
when input value is null
resolve Uncaught TypeError: Cannot read property 'toString' of null
  • Loading branch information
iugo authored and e111077 committed Jul 13, 2016
1 parent a147abc commit 6f376bd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions iron-request.html
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@
_wwwFormUrlEncodePiece: function(str) {
// Spec says to normalize newlines to \r\n and replace %20 spaces with +.
// jQuery does this as well, so this is likely to be widely compatible.
if (str === null) {
return '';
}
return encodeURIComponent(str.toString().replace(/\r?\n/g, '\r\n'))
.replace(/%20/g, '+');
},
Expand Down

0 comments on commit 6f376bd

Please sign in to comment.