Expand streaming response types and subtypes

Added more constants for streaming-related MIME subtypes and updated kStreamingResponseTypes to include additional formats. This improves support for various streaming response types in the networking package.
This commit is contained in:
Ankit Mahato
2025-08-05 16:22:27 +05:30
parent ae478c85ed
commit 304447bf17

View File

@@ -56,13 +56,6 @@ enum HTTPVerb {
final String abbr;
}
List<String> kStreamingResponseTypes = [
'text/event-stream',
'application/x-ndjson',
'application/json-seq',
'application/octet-stream',
];
enum SupportedUriSchemes { https, http }
final kSupportedUriSchemes = SupportedUriSchemes.values
@@ -96,6 +89,15 @@ const kSubTypeYaml = 'yaml';
const kSubTypeXYaml = 'x-yaml';
const kSubTypeYml = 'x-yml';
const kSubTypeXWwwFormUrlencoded = 'x-www-form-urlencoded';
const kSubTypeXNdjson = 'x-ndjson';
const kSubTypeNdjson = 'ndjson';
const kSubTypeJsonSeq = 'json-seq';
const kSubTypeXLdjson = 'x-ldjson';
const kSubTypeLdjson = 'ldjson';
const kSubTypeXJsonStream = 'x-json-stream';
const kSubTypeJsonStream = 'json-stream';
const kSubTypeJsonstream = 'jsonstream';
const kSubTypeStreamJson = 'stream+json';
const kTypeText = 'text';
// text
@@ -108,6 +110,7 @@ const kSubTypePlain = 'plain';
const kSubTypeTextXml = 'xml';
const kSubTypeTextYaml = 'yaml';
const kSubTypeTextYml = 'yml';
const kSubTypeEventStream = 'event-stream';
const kTypeImage = 'image';
//image
@@ -121,6 +124,19 @@ const kSubTypeFormData = "form-data";
const kSubTypeDefaultViewOptions = 'all';
List<String> kStreamingResponseTypes = [
'$kTypeText/$kSubTypeEventStream',
'$kTypeApplication/$kSubTypeXNdjson',
'$kTypeApplication/$kSubTypeNdjson',
'$kTypeApplication/$kSubTypeJsonSeq',
'$kTypeApplication/$kSubTypeXLdjson',
'$kTypeApplication/$kSubTypeLdjson',
'$kTypeApplication/$kSubTypeXJsonStream',
'$kTypeApplication/$kSubTypeJsonStream',
'$kTypeApplication/$kSubTypeJsonstream',
'$kTypeApplication/$kSubTypeStreamJson',
];
enum ContentType {
json("$kTypeApplication/$kSubTypeJson"),
text("$kTypeText/$kSubTypePlain"),