Skip to content

Commit

Permalink
Merge pull request #189 from ivancorrea/master
Browse files Browse the repository at this point in the history
Set user-agent error on Browser (merge sem validações dado que é um bugfix)
  • Loading branch information
lucianopf authored Dec 4, 2020
2 parents 664add8 + a560c54 commit 7a8d0be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 5 additions & 2 deletions src/services/viacep.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7a8d0be

Please sign in to comment.