@digitransit-component/digitransit-component-autosuggest 11.0.9 → 11.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -12519,7 +12519,9 @@ function serialize(obj, prefix) {
12519
12519
  }
12520
12520
 
12521
12521
  /**
12522
- * Return Promise for a url json get request
12522
+ * Return Promise for a url json get request. The promise rejects on network
12523
+ * errors, timeouts (10 s), HTTP 4xx/5xx responses (the error carries
12524
+ * `response.status`) and response bodies that are not valid JSON.
12523
12525
  *
12524
12526
  * @name getJson
12525
12527
  * @param {String} url
@@ -12534,6 +12536,12 @@ function getJson(url, params) {
12534
12536
  return axios.get(encodeURI(url) + (params ? (url.search(/\?/) === -1 ? '?' : '&') + serialize(params) : ''), {
12535
12537
  timeout: 10000,
12536
12538
  method: 'GET',
12539
+ // Reject non-JSON bodies (e.g. an HTML error page from a proxy)
12540
+ // instead of resolving with the raw string, which is axios's default.
12541
+ responseType: 'json',
12542
+ transitional: {
12543
+ silentJSONParsing: false
12544
+ },
12537
12545
  headers: {
12538
12546
  Accept: 'application/json'
12539
12547
  }