dart_frog icon indicating copy to clipboard operation
dart_frog copied to clipboard

fix: UTF-8 chars "outside" ASCII will set content-type to application/octet-stream

Open DanielBachmann opened this issue 5 months ago • 2 comments

Description

When returning a Response with a body that contains a non-ASCII character, like "ö, ä, ü, etc." in german or a 😊 for that matter, the responses content-type will be set to application/octet-stream. That in turn will result in "save file" dialog if the route was called in a browser.

Steps To Reproduce

  1. create new dart frog project
  2. add a utf-8 character that isn't in ASCII as well to the Response body in index.dart
  3. run dev server
  4. call in Browser

Expected Behavior

Getting a text/plain response (with utf-8 encoding) when using utf-8 character in a Response body String.

Additional Context

My apologies if this is expected behavior. This basically doesn't matter that much if one would use dart frog for an API or just set the header manually, but it took me quite some time to figure out what is wrong when doing the tutorials.

DanielBachmann avatar Sep 20 '24 12:09 DanielBachmann