From 97b49ae7081b989274b313532ff17c71694097a9 Mon Sep 17 00:00:00 2001 From: Murilo Ijanc Date: Mon, 27 Jul 2026 21:12:05 -0300 Subject: Read the faixa from the client instead of fetching it again cep.is/go v0.2.0 exposes the municipality as Error.Faixa, which is what internal/lookup existed to work around: v0.1.0 discarded the 404 body, so the bot re-issued the request just to read the block back. The extra GET on the 404 path is gone, and with it the second timeout, the body size cap and the "is it still a 404?" check that guarded it. The replies are byte for byte what they were -- the formatting tests did not change a single assertion, only the type they build. --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index aad82cf..3feea80 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,9 @@ A cidade vem no próprio 404 da API, no objeto `faixa`. Quando o CEP cai num intervalo que os Correios não deram a município nenhum, o objeto não vem e a resposta é a de sempre, sem a linha do meio. -Por enquanto isso custa um GET a mais, e só no caminho do 404: o `cep.is/go` -v0.1.0 joga fora o corpo da resposta 404, e é de lá que a faixa é lida -(`internal/lookup`). Qualquer problema nessa segunda consulta — lentidão, JSON -quebrado, faixa sem município — cai de volta na resposta de sempre. Some quando -a biblioteca expuser o campo. +Não custa requisição nenhuma a mais: quem lê o objeto é o `cep.is/go` v0.2.0, +em `Error.Faixa`. Faixa ausente ou sem município cai de volta na resposta de +sempre. ## Criando o bot -- cgit v1.3