MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / $HttpParamSerializerProvider

Function $HttpParamSerializerProvider

lib/test/angular/1.7.0/angular.js:11327–11362  ·  view source on GitHub ↗

@this

()

Source from the content-addressed store, hash-verified

11325
11326/** @this */
11327function $HttpParamSerializerProvider() {
11328 /**
11329 * @ngdoc service
11330 * @name $httpParamSerializer
11331 * @description
11332 *
11333 * Default {@link $http `$http`} params serializer that converts objects to strings
11334 * according to the following rules:
11335 *
11336 * * `{'foo': 'bar'}` results in `foo=bar`
11337 * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
11338 * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
11339 * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object)
11340 *
11341 * Note that serializer will sort the request parameters alphabetically.
11342 */
11343
11344 this.$get = function() {
11345 return function ngParamSerializer(params) {
11346 if (!params) return '';
11347 var parts = [];
11348 forEachSorted(params, function(value, key) {
11349 if (value === null || isUndefined(value) || isFunction(value)) return;
11350 if (isArray(value)) {
11351 forEach(value, function(v) {
11352 parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));
11353 });
11354 } else {
11355 parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
11356 }
11357 });
11358
11359 return parts.join('&');
11360 };
11361 };
11362}
11363
11364/** @this */
11365function $HttpParamSerializerJQLikeProvider() {

Callers

nothing calls this directly

Calls 7

forEachSortedFunction · 0.70
isUndefinedFunction · 0.70
isFunctionFunction · 0.70
isArrayFunction · 0.70
forEachFunction · 0.70
encodeUriQueryFunction · 0.70
serializeValueFunction · 0.70

Tested by

no test coverage detected