1 |
|
2 |
|
3 | /**
|
4 | * Gets full query as string with all special chars decoded.
|
5 | */
|
6 | function getQuery(url) {
|
7 | // url = url.replace(/#.*\?/, '?'); //removes hash (to avoid getting hash query)
|
8 | var queryString = /\?[a-zA-Z0-9\=\&\%\$\-\_\.\+\!\*\'\(\)\,]+/.exec(url); //valid chars according to: http://www.ietf.org/rfc/rfc1738.txt
|
9 | return (queryString)? decodeURIComponent(queryString[0].replace(/\+/g,' ')) : '';
|
10 | }
|
11 |
|
12 | module.exports = getQuery;
|
13 |
|