()
| 9604 | |
| 9605 | |
| 9606 | function $HttpParamSerializerProvider() { |
| 9607 | /** |
| 9608 | * @ngdoc service |
| 9609 | * @name $httpParamSerializer |
| 9610 | * @description |
| 9611 | * |
| 9612 | * Default {@link $http `$http`} params serializer that converts objects to strings |
| 9613 | * according to the following rules: |
| 9614 | * |
| 9615 | * * `{'foo': 'bar'}` results in `foo=bar` |
| 9616 | * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object) |
| 9617 | * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element) |
| 9618 | * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object) |
| 9619 | * |
| 9620 | * Note that serializer will sort the request parameters alphabetically. |
| 9621 | * */ |
| 9622 | |
| 9623 | this.$get = function() { |
| 9624 | return function ngParamSerializer(params) { |
| 9625 | if (!params) return ''; |
| 9626 | var parts = []; |
| 9627 | forEachSorted(params, function(value, key) { |
| 9628 | if (value === null || isUndefined(value)) return; |
| 9629 | if (isArray(value)) { |
| 9630 | forEach(value, function(v, k) { |
| 9631 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); |
| 9632 | }); |
| 9633 | } else { |
| 9634 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value))); |
| 9635 | } |
| 9636 | }); |
| 9637 | |
| 9638 | return parts.join('&'); |
| 9639 | }; |
| 9640 | }; |
| 9641 | } |
| 9642 | |
| 9643 | function $HttpParamSerializerJQLikeProvider() { |
| 9644 | /** |
nothing calls this directly
no test coverage detected