f3ath / dart-http-interop

A thin package to allow interoperability between HTTP different client and server implementations in Dart
MIT License
0 stars 1 forks source link

Empty Text in Body Constructor Should Return Empty Stream or Null instead of [[]] #11

Closed aliaksei-liavonik closed 11 months ago

aliaksei-liavonik commented 1 year ago

Current: When initializing the Body object with an empty text parameter, the resulting stream contains an empty list ([[]]).

Body(String text, Encoding encoding)
    : this.binary(Uint8List.fromList(encoding.encode(''))); 
    // Returns [[]] via Body.binary constructor

Expected: When the text parameter is empty, the stream should ideally be empty as well, instead of returning [[]]. Alternatively, returning null might be a more intuitive and cleaner solution. However, I understand this might complicate things due to structural changes in the code.

f3ath commented 1 year ago

Thank you!

f3ath commented 1 year ago

@aliaksei-liavonik please LMK if the fix works for you.

f3ath commented 11 months ago

Closing as fixed