Comparing version 31.2.4 to 31.3.0
@@ -60,3 +60,3 @@ 'use strict'; | ||
* This class is used as the backbone for d2 and handles all the interaction with the server. There is a singleton | ||
* available to be reused across your applications. The singleton can be grabbed from the d2 instance. | ||
* available to be reused across your applications. The singleton can be grabbed from the d2 instance. The api methods all handle URL-encoding for you, so you can just pass them unencoded strings | ||
* | ||
@@ -150,4 +150,4 @@ * ```js | ||
* | ||
* @param {string} url The url for the request | ||
* @param {*} data Any data that should be send with the request. For a GET request these are turned into | ||
* @param {string} url The url for the request, should be unencoded. Will return a rejected promise for malformed urls and urls that contain encoded query strings. | ||
* @param {*} data Any data that should be sent with the request. For a GET request these are encoded and turned into | ||
* query parameters. For POST and PUT requests it becomes the body. | ||
@@ -300,2 +300,22 @@ * @param {Object.<string, any>} options The request options are passed as options to the fetch request. | ||
// Encode existing query parameters, since tomcat does not accept unencoded brackets. Throw | ||
// an error if they're already encoded to prevent double encoding. | ||
if (query) { | ||
var decodedURL = void 0; | ||
try { | ||
decodedURL = decodeURIComponent(query); | ||
} catch (err) { | ||
return Promise.reject(new Error('Query parameters in URL are invalid')); | ||
} | ||
var isEncoded = query !== decodedURL; | ||
if (isEncoded) { | ||
return Promise.reject(new Error('Cannot process URL-encoded URLs, pass an unencoded URL')); | ||
} | ||
query = (0, _utils.customEncodeURIComponent)(query); | ||
} | ||
// Transfer filter properties from the data object to the query string | ||
@@ -307,3 +327,3 @@ if (data && Array.isArray(data.filter)) { | ||
query = '' + (0, _utils.customEncodeURIComponent)(query) + (query.length ? '&' : '') + ('filter=' + encodedFilters.join('&filter=')); | ||
query = '' + query + (query.length ? '&' : '') + 'filter=' + encodedFilters.join('&filter='); | ||
delete data.filter; // eslint-disable-line no-param-reassign | ||
@@ -310,0 +330,0 @@ } |
{ | ||
"name": "d2", | ||
"version": "31.2.4", | ||
"version": "31.3.0", | ||
"description": "Javascript library for DHIS2", | ||
@@ -5,0 +5,0 @@ "main": "d2.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3890387
9481