From e8604d2a51907765f8f93eee6d9e4150c063d9aa Mon Sep 17 00:00:00 2001 From: Ivan Correa Date: Sun, 27 Sep 2020 16:28:05 -0300 Subject: [PATCH 1/2] viacep: browser user-agent error --- src/services/viacep.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/services/viacep.js b/src/services/viacep.js index 2545887..d568b3e 100644 --- a/src/services/viacep.js +++ b/src/services/viacep.js @@ -9,11 +9,14 @@ export default function fetchViaCepService (cepWithLeftPad, proxyURL = '') { method: 'GET', mode: 'cors', headers: { - 'content-type': 'application/json;charset=utf-8', - 'user-agent': '' + 'content-type': 'application/json;charset=utf-8' } } + if (typeof window == 'undefined') { + options.headers['user-agent'] = 'cep-promise' + } + return fetch(url, options) .then(analyzeAndParseResponse) .then(checkForViaCepError) From a560c542f1398cd479a5a2304f3dcb3cd72536d0 Mon Sep 17 00:00:00 2001 From: lucianopf Date: Fri, 4 Dec 2020 20:55:06 -0300 Subject: [PATCH 2/2] npm: bump package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5aeca26..6d26b73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cep-promise", - "version": "4.0.2", + "version": "4.0.3", "description": "Busca por CEP integrado diretamente aos serviços dos Correios e ViaCEP", "main": "dist/cep-promise.min.js", "module": "dist/cep-promise.min.js",