@this
()
| 11959 | |
| 11960 | /** @this */ |
| 11961 | function $HttpParamSerializerProvider() { |
| 11962 | /** |
| 11963 | * @ngdoc service |
| 11964 | * @name $httpParamSerializer |
| 11965 | * @description |
| 11966 | * |
| 11967 | * Default {@link $http `$http`} params serializer that converts objects to strings |
| 11968 | * according to the following rules: |
| 11969 | * |
| 11970 | * * `{'foo': 'bar'}` results in `foo=bar` |
| 11971 | * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object) |
| 11972 | * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element) |
| 11973 | * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object) |
| 11974 | * |
| 11975 | * Note that serializer will sort the request parameters alphabetically. |
| 11976 | */ |
| 11977 | |
| 11978 | this.$get = function() { |
| 11979 | return function ngParamSerializer(params) { |
| 11980 | if (!params) return ''; |
| 11981 | var parts = []; |
| 11982 | forEachSorted(params, function(value, key) { |
| 11983 | if (value === null || isUndefined(value) || isFunction(value)) return; |
| 11984 | if (isArray(value)) { |
| 11985 | forEach(value, function(v) { |
| 11986 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); |
| 11987 | }); |
| 11988 | } else { |
| 11989 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value))); |
| 11990 | } |
| 11991 | }); |
| 11992 | |
| 11993 | return parts.join('&'); |
| 11994 | }; |
| 11995 | }; |
| 11996 | } |
| 11997 | |
| 11998 | /** @this */ |
| 11999 | function $HttpParamSerializerJQLikeProvider() { |
nothing calls this directly
no test coverage detected