openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[dart2] [client] Adds correct deserialization of octet-streams into Uint8List

Open 0xNF opened this issue 2 years ago • 0 comments

fix #12161

This PR is part of the effort to split PR https://github.com/OpenAPITools/openapi-generator/pull/17548

This PR is a bit meatier than the others -- I copied much of the logic for adding uint8list support to the AbstractDartCodegen from the Dart-dio generator.

The big changes to look out for are:

  • octet streams now correctly deserde into Uint8List, instead of the previous MultipartFile (which was fine for uploads, but invalid for downloads)
  • decodeBodyBytes() and deserialize() now returns dynamic instead of String, which lets us switch on the content-type to return either a string, or a Uint8List.

@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)

0xNF avatar Feb 07 '24 13:02 0xNF