()
| 9129 | |
| 9130 | |
| 9131 | function $HttpParamSerializerProvider() { |
| 9132 | /** |
| 9133 | * @ngdoc service |
| 9134 | * @name $httpParamSerializer |
| 9135 | * @description |
| 9136 | * |
| 9137 | * Default {@link $http `$http`} params serializer that converts objects to strings |
| 9138 | * according to the following rules: |
| 9139 | * |
| 9140 | * * `{'foo': 'bar'}` results in `foo=bar` |
| 9141 | * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object) |
| 9142 | * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element) |
| 9143 | * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object) |
| 9144 | * |
| 9145 | * Note that serializer will sort the request parameters alphabetically. |
| 9146 | * */ |
| 9147 | |
| 9148 | this.$get = function() { |
| 9149 | return function ngParamSerializer(params) { |
| 9150 | if (!params) return ''; |
| 9151 | var parts = []; |
| 9152 | forEachSorted(params, function(value, key) { |
| 9153 | if (value === null || isUndefined(value)) return; |
| 9154 | if (isArray(value)) { |
| 9155 | forEach(value, function(v, k) { |
| 9156 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); |
| 9157 | }); |
| 9158 | } else { |
| 9159 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value))); |
| 9160 | } |
| 9161 | }); |
| 9162 | |
| 9163 | return parts.join('&'); |
| 9164 | }; |
| 9165 | }; |
| 9166 | } |
| 9167 | |
| 9168 | function $HttpParamSerializerJQLikeProvider() { |
| 9169 | /** |
nothing calls this directly
no test coverage detected