mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 02:07:00 +08:00
Refactor auth handling in HTTP request functions
Removed redundant AuthModel parameter from sendHttpRequest and streamHttpRequest functions, now using authModel from HttpRequestModel directly. Updated all usages, tests, and related logic to reflect this change. Improved streaming response handling in CollectionStateNotifier and HttpResponseModel.
This commit is contained in:
@@ -62,7 +62,11 @@ class HttpResponseModel with _$HttpResponseModel {
|
||||
String? get contentType => headers?.getValueContentType();
|
||||
MediaType? get mediaType => getMediaTypeFromHeaders(headers);
|
||||
|
||||
HttpResponseModel fromResponse({required Response response, Duration? time}) {
|
||||
HttpResponseModel fromResponse({
|
||||
required Response response,
|
||||
Duration? time,
|
||||
bool isStreamingResponse = false,
|
||||
}) {
|
||||
final responseHeaders = mergeMaps({
|
||||
HttpHeaders.contentLengthHeader: response.contentLength.toString(),
|
||||
}, response.headers);
|
||||
@@ -80,6 +84,7 @@ class HttpResponseModel with _$HttpResponseModel {
|
||||
formattedBody: formatBody(body, mediaType),
|
||||
bodyBytes: response.bodyBytes,
|
||||
time: time,
|
||||
sseOutput: isStreamingResponse ? [body] : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user