Skip to content

Commit

Permalink
chore: quickfix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianopf committed Nov 23, 2022
1 parent 062c831 commit 5ac36e3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pages/api/cep/v2/[cep].js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ async function getCepFromCepPromise(requestedCep) {
}

async function Cep(request, response) {
if (
request.headers['user-agent'] === 'axios/0.21.4' &&
!request.headers.origin &&
(request.url.includes('/api/cep/v2/1') ||
request.url.includes('/api/cep/v2/0'))
) {
response.status(200);
response.send('please stop abusing our public API, join our slack to chat a bit https://join.slack.com/t/brasilapi/shared_invite/zt-1k9w5h27p-4yLWoOQqIMgwqunnHCyWCQ');
return true;
}

const requestedCep = request.query.cep;

response.setHeader('Cache-Control', CACHE_CONTROL_HEADER_VALUE);
Expand Down

1 comment on commit 5ac36e3

@vercel
Copy link

@vercel vercel bot commented on 5ac36e3 Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

brasilapi – ./

brasilapi-brasilapi.vercel.app
brasilapi-git-main-brasilapi.vercel.app
brasilapi.com.br

Please sign in to comment.