“Client Dart Httop” Réponses codées

Client Dart Httop

import 'package:http/http.dart' as http;

var url = 'https://example.com/whatsit/create';
var response = await http.post(url, body: {'name': 'doodle', 'color': 'blue'});
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');

print(await http.read('https://example.com/foobar.txt'));
Grumpy Gorilla

Client Dart Httop

var client = http.Client();
try {
  var uriResponse = await client.post('https://example.com/whatsit/create',
      body: {'name': 'doodle', 'color': 'blue'});
  print(await client.get(uriResponse.bodyFields['uri']));
} finally {
  client.close();
}
Grumpy Gorilla

Réponses similaires à “Client Dart Httop”

Questions similaires à “Client Dart Httop”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code