MCPcopy Create free account
hub / github.com/apache/cloudstack / encodeUriQuery

Function encodeUriQuery

tools/ngui/static/js/lib/angular.js:876–883  ·  view source on GitHub ↗

* This method is intended for encoding *key* or *value* parts of query component. We need a custom * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be * encoded per http://tools.ietf.org/html/rfc3986: * query = *( pchar / "/" / "?" ) * pcha

(val, pctEncodeSpaces)

Source from the content-addressed store, hash-verified

874 * / "*" / "+" / "," / ";" / "="
875 */
876function encodeUriQuery(val, pctEncodeSpaces) {
877 return encodeURIComponent(val).
878 replace(/%40/gi, '@').
879 replace(/%3A/gi, ':').
880 replace(/%24/g, '$').
881 replace(/%2C/gi, ',').
882 replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
883}
884
885
886/**

Callers 2

toKeyValueFunction · 0.85
encodeUriSegmentFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected