Dart Frog Dart
Ein Dart-Snippet für Dart Frog, das Anfragen an /pixel.gif mit dem leeren GIF beantwortet, das einmal beim Start dekodiert wird.
Dart Frog Dart
// routes/pixel.gif.dart: the file name is the route.
import 'dart:convert';
import 'package:dart_frog/dart_frog.dart';
final _gif = base64Decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
Response onRequest(RequestContext context) {
return Response.bytes(
body: _gif,
headers: {'content-type': 'image/gif', 'cache-control': 'no-store'},
);
}
Wir haben dieses Snippet ausgeführt und die zurückgegebenen Bytes verglichen.
Prüfen
curl -sI http://localhost:8080/pixel.gif