()
| 10014 | |
| 10015 | |
| 10016 | function $HttpParamSerializerProvider() { |
| 10017 | /** |
| 10018 | * @ngdoc service |
| 10019 | * @name $httpParamSerializer |
| 10020 | * @description |
| 10021 | * |
| 10022 | * Default {@link $http `$http`} params serializer that converts objects to strings |
| 10023 | * according to the following rules: |
| 10024 | * |
| 10025 | * * `{'foo': 'bar'}` results in `foo=bar` |
| 10026 | * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object) |
| 10027 | * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element) |
| 10028 | * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object) |
| 10029 | * |
| 10030 | * Note that serializer will sort the request parameters alphabetically. |
| 10031 | * */ |
| 10032 | |
| 10033 | this.$get = function() { |
| 10034 | return function ngParamSerializer(params) { |
| 10035 | if (!params) return ''; |
| 10036 | var parts = []; |
| 10037 | forEachSorted(params, function(value, key) { |
| 10038 | if (value === null || isUndefined(value)) return; |
| 10039 | if (isArray(value)) { |
| 10040 | forEach(value, function(v, k) { |
| 10041 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); |
| 10042 | }); |
| 10043 | } else { |
| 10044 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value))); |
| 10045 | } |
| 10046 | }); |
| 10047 | |
| 10048 | return parts.join('&'); |
| 10049 | }; |
| 10050 | }; |
| 10051 | } |
| 10052 | |
| 10053 | function $HttpParamSerializerJQLikeProvider() { |
| 10054 | /** |
nothing calls this directly
no test coverage detected