@this
()
| 11894 | |
| 11895 | /** @this */ |
| 11896 | function $HttpParamSerializerProvider() { |
| 11897 | /** |
| 11898 | * @ngdoc service |
| 11899 | * @name $httpParamSerializer |
| 11900 | * @description |
| 11901 | * |
| 11902 | * Default {@link $http `$http`} params serializer that converts objects to strings |
| 11903 | * according to the following rules: |
| 11904 | * |
| 11905 | * * `{'foo': 'bar'}` results in `foo=bar` |
| 11906 | * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object) |
| 11907 | * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element) |
| 11908 | * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object) |
| 11909 | * |
| 11910 | * Note that serializer will sort the request parameters alphabetically. |
| 11911 | */ |
| 11912 | |
| 11913 | this.$get = function() { |
| 11914 | return function ngParamSerializer(params) { |
| 11915 | if (!params) return ''; |
| 11916 | var parts = []; |
| 11917 | forEachSorted(params, function(value, key) { |
| 11918 | if (value === null || isUndefined(value) || isFunction(value)) return; |
| 11919 | if (isArray(value)) { |
| 11920 | forEach(value, function(v) { |
| 11921 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); |
| 11922 | }); |
| 11923 | } else { |
| 11924 | parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value))); |
| 11925 | } |
| 11926 | }); |
| 11927 | |
| 11928 | return parts.join('&'); |
| 11929 | }; |
| 11930 | }; |
| 11931 | } |
| 11932 | |
| 11933 | /** @this */ |
| 11934 | function $HttpParamSerializerJQLikeProvider() { |
nothing calls this directly
no test coverage detected