Closed denisales closed 7 months ago
I was creating a GET endpoint, and when returning the text Hello World in Portuguese, GET started opening a download window.
Is this behavior normal?
Dart SDK version: 3.2.3 (stable) on "windows_x64"
main.dart
import 'package:shelf/shelf_io.dart' as shelf_io; import 'app_handler_server.dart'; void main() async { var serveHandler = AppHandlerServer(); final server = await shelf_io.serve(serveHandler.handler, 'localhost', 8080); print('Server is running...'); }
app_handler_server.dart
import 'package:shelf/shelf.dart'; import 'package:shelf_router/shelf_router.dart'; class AppHandlerServer { Handler get handler { final router = Router(); router.get('/', (Request req) { //Try returning the String Olá mundo with an accent and without an accent and see the difference. // return Response(200, body: 'Ola mundo'); return Response(200, body: 'Olá mundo'); }); return router; } }
Solved, I needed to put the header as: text/plain; charset=utf-8
I was creating a GET endpoint, and when returning the text Hello World in Portuguese, GET started opening a download window.
Is this behavior normal?
Dart SDK version: 3.2.3 (stable) on "windows_x64"
main.dart
app_handler_server.dart