From 32cac749fdf88b7033eb4ba7c47d1e407bc9ac0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ada=C3=ADas=20Magdiel?= Date: Thu, 14 Mar 2024 15:31:33 -0300 Subject: [PATCH 1/3] docs(pt-br): Start Portuguese translation for HTTPie article - Start translation of the HTTPie article to Portuguese language for better accessibility and understanding. --- pt-br/httpie-pt.html.markdown | 122 ++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 pt-br/httpie-pt.html.markdown diff --git a/pt-br/httpie-pt.html.markdown b/pt-br/httpie-pt.html.markdown new file mode 100644 index 00000000..9a601fb2 --- /dev/null +++ b/pt-br/httpie-pt.html.markdown @@ -0,0 +1,122 @@ +--- +category: tool +tool: httpie +filename: learn-httpie-pt.sh +contributors: + - ["Adaías Magdiel", "https://github.com/AdaiasMagdiel"] +translators: + - ["Adaías Magdiel", "https://adaiasmagdiel.com/"] +lang: pt-br +--- + +HTTPie é um poderoso cliente HTTP para linha de comando, projetado para uma +integração suave com servidores HTTP. Oferece uma interface simples e intuitiva, +tornando-se uma excelente ferramenta para desenvolvedores, testadores e administradores de sistemas. + +## Uso Básico + +HTTPie possui uma sintaxe simples: http [flags] [MÉTODO] URL [itens]. + +```bash +http GET https://api.example.com/posts +``` + +Você pode exibir a requisição sem executá-la, de fato, usando a flag `--offline`. + +```bash +http --offline https://api.example.com/posts +``` + +### Encurtando URLs `localhost` + +HTTPie fornece suporte a atalhos para o localhost, similares aos do `curl`. Por exemplo, ":3000" +expande para "http://localhost:3000". Se a porta for omitida, o padrão será a porta 80. + +```bash +http :/users # http://localhost/users +http :5000/rss # http://localhost:5000/rss +``` + +### Métodos Opcionais GET e POST + +Se você não especificar o método, o HTTPie usará o seguinte: + +- GET para requisições sem corpo +- POST para requisições com corpo + +```bash +http https://api.example.com/tags # GET - Seleciona as tags +http https://api.example.com/tags title="Tutorial" slug="tutorial" # POST - Cria uma nova tag +``` + +## Parâmetros Querystring + +Se você adiciona querystrings manualmente no terminal, tente a seguinte sintaxe: +`param==value`. Isso evita que o shell tente reconhecer o operador & como comando +e automaticamente escape caracteres especiais nos parâmetros. +Isso difere dos parâmetros na URL completa, que o HTTPie não modifica. + +```bash +http https://api.example.com/search q==httpie per_page==20 +``` + +## Enviando Dados + +Você pode enviar dados nos mais diversos formatos, como JSON, formulários ou arquivos. + +### JSON Data + +```bash +http POST https://api.example.com/posts title="Hello" body="World" +``` + +### Form Data + +```bash +http -f POST https://api.example.com/submit name=John email=john@example.com +``` + +### Files + +```bash +http --form POST https://api.example.com/upload file@/path/to/file.txt +``` + +## Headers and Authentication + +HTTPie allows you to set headers and handle authentication easily. + +### Headers + +```bash +http GET https://api.example.com/posts Authorization:"Bearer Token" User-Agent:"HTTPie" +``` + +### Basic Authentication + +```bash +http -a username:password GET https://api.example.com/protected +``` + +### Bearer Authentication + +```bash +https -A bearer -a token https://api.example.com/admin +``` + +## Response Handling + +HTTPie provides various options for handling responses. + +```bash +http GET https://api.example.com/data Accept:application/json # Pretty Print JSON + +http GET https://api.example.com/image --output image.png # Save Response to File + +http --follow GET https://example.com # Follow Redirects +``` + +## Further Reading + +- [Official Documentation](https://httpie.io/docs/cli). +- [Github](https://github.com/httpie). From 1575bceff3e6d0676884d6b0300bece62f9930ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ada=C3=ADas=20Magdiel?= Date: Fri, 15 Mar 2024 08:41:01 -0300 Subject: [PATCH 2/3] docs(httpie-pt): Add Portuguese translation - Updated the Portuguese translation for better clarity and consistency throughout the document. - Updated references to HTTP methods for sending JSON, forms, and files to use native Portuguese terms. - Improved the translations of headers, authentication methods, and response handling instructions to make them more understandable for Portuguese speakers. - Updated URLs in the "Further Reading" section to point to the correct Portuguese resources. --- pt-br/httpie-pt.html.markdown | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pt-br/httpie-pt.html.markdown b/pt-br/httpie-pt.html.markdown index 9a601fb2..9ef515bc 100644 --- a/pt-br/httpie-pt.html.markdown +++ b/pt-br/httpie-pt.html.markdown @@ -64,27 +64,27 @@ http https://api.example.com/search q==httpie per_page==20 Você pode enviar dados nos mais diversos formatos, como JSON, formulários ou arquivos. -### JSON Data +### Enviando JSON ```bash -http POST https://api.example.com/posts title="Hello" body="World" +http POST https://api.example.com/posts title="Olá" body="Mundo" ``` -### Form Data +### Enviando Formulário ```bash http -f POST https://api.example.com/submit name=John email=john@example.com ``` -### Files +### Enviando Arquivos ```bash -http --form POST https://api.example.com/upload file@/path/to/file.txt +http --form POST https://api.example.com/upload file@/caminho/do/arquivo.txt ``` -## Headers and Authentication +## Headers e Autenticação -HTTPie allows you to set headers and handle authentication easily. +HTTPie permite que você adicione headers e lide com autenticação de uma forma fácil. ### Headers @@ -92,31 +92,31 @@ HTTPie allows you to set headers and handle authentication easily. http GET https://api.example.com/posts Authorization:"Bearer Token" User-Agent:"HTTPie" ``` -### Basic Authentication +### Autenticação Básica ```bash -http -a username:password GET https://api.example.com/protected +http -a usuario:senha GET https://api.example.com/protected ``` -### Bearer Authentication +### Autenticação Bearer ```bash https -A bearer -a token https://api.example.com/admin ``` -## Response Handling +## Lidando com Respostas -HTTPie provides various options for handling responses. +HTTPie fornece várias opções para lidar com respostas. ```bash -http GET https://api.example.com/data Accept:application/json # Pretty Print JSON +http GET https://api.example.com/data Accept:application/json # Exibe o JSON de uma forma legível -http GET https://api.example.com/image --output image.png # Save Response to File +http GET https://api.example.com/image --output image.png # Grava a resposta em um arquivo -http --follow GET https://example.com # Follow Redirects +http --follow GET https://example.com # Segue redirecionamentos ``` -## Further Reading +## Leitura Adicional -- [Official Documentation](https://httpie.io/docs/cli). +- [Documentação Oficial](https://httpie.io/docs/cli). - [Github](https://github.com/httpie). From 10304f3a7e0e6f22c4ec34f5209ec13dbcdf8637 Mon Sep 17 00:00:00 2001 From: Boris Verkhovskiy Date: Thu, 4 Apr 2024 08:00:12 -0700 Subject: [PATCH 3/3] Update httpie-pt.html.markdown --- pt-br/httpie-pt.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pt-br/httpie-pt.html.markdown b/pt-br/httpie-pt.html.markdown index 9ef515bc..f81919fe 100644 --- a/pt-br/httpie-pt.html.markdown +++ b/pt-br/httpie-pt.html.markdown @@ -119,4 +119,4 @@ http --follow GET https://example.com # Segue redirecionamentos ## Leitura Adicional - [Documentação Oficial](https://httpie.io/docs/cli). -- [Github](https://github.com/httpie). +- [GitHub](https://github.com/httpie).