This file contains hidden or 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
import 'dart:convert' as convert; | |
import 'package:http/http.dart' as http; | |
void main(List<String> arguments) async { | |
final urlHttpBin = Uri.https('httpbin.org', '/basic-auth/myuser/mypasswd'); | |
const base64Encoder = convert.Base64Encoder(); | |
var creds64 = base64Encoder.convert('myuser:mypasswd'.codeUnits); | |
// https://pub.dev/documentation/http/latest/http/Client-class.html |
This file contains hidden or 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
import java.io.BufferedReader | |
import java.io.InputStreamReader | |
import java.net.HttpURLConnection | |
import java.net.URI | |
import java.net.URL | |
fun main() { | |
val apiUrl = "https://catfact.ninja/fact" //API endpoint | |
// add proxy support if your pc is behind a corporate proxy | |
System.setProperty("java.net.useSystemProxies", "true"); |
OlderNewer