Last active
July 14, 2021 00:46
-
-
Save nunomazer/0b9b308a78e14148d8710d37ab7c82e9 to your computer and use it in GitHub Desktop.
Exemplo de uso de khttp com Kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tutorial para a seção do livro de dev mobile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
khttp.get("https://meuservidor.com.br/api/usuarios") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
khttp.get( | |
url = "https://meuservidor.com.br/produtos", | |
params = mapOf("categoria" to "Carnes")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>khttp</groupId> | |
<artifactId>khttp</artifactId> | |
<version>0.1.0</version> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val resposta : Response = khttp.get( | |
url = "https://meuservidor.com.br/produtos", | |
params = mapOf("categoria" to "Carnes")) | |
val objeto : JSONObject = resposta.jsonObject | |
print(objeto["mensagem"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment