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:
Ankit Mahato
2025-08-06 02:42:23 +05:30
parent 81e967b1b3
commit 625254b20f
10 changed files with 52 additions and 102 deletions

View File

@@ -24,7 +24,6 @@ void main() {
final stream = await streamHttpRequest(
'graphql_test',
APIType.graphql,
null,
model,
);
@@ -55,7 +54,6 @@ void main() {
final stream = await streamHttpRequest(
'graphql_bad',
APIType.graphql,
null,
model,
);
final output = await stream.first;
@@ -78,7 +76,6 @@ void main() {
final stream = await streamHttpRequest(
'graphql_test_cancellation',
APIType.graphql,
null,
model,
);
httpClientManager.cancelRequest('graphql_test_cancellation');

View File

@@ -19,7 +19,6 @@ void main() {
final (resp, dur, err) = await sendHttpRequest(
'get_test',
APIType.rest,
null,
model,
);
final output = jsonDecode(resp?.body ?? '{}');
@@ -60,7 +59,6 @@ void main() {
final (resp, dur, err) = await sendHttpRequest(
'mpreq',
APIType.rest,
null,
model,
);
final output = jsonDecode(resp?.body ?? '{}');
@@ -88,12 +86,7 @@ void main() {
NameValueModel(name: 'Accept', value: 'application/json'),
],
);
final stream = await streamHttpRequest(
'get_test',
APIType.rest,
null,
model,
);
final stream = await streamHttpRequest('get_test', APIType.rest, model);
final output = await stream.first;
expect(
output?.$2?.statusCode == 200,
@@ -115,12 +108,7 @@ void main() {
}""",
);
final stream = await streamHttpRequest(
'post_test',
APIType.rest,
null,
model,
);
final stream = await streamHttpRequest('post_test', APIType.rest, model);
final output = await stream.first;
expect(output?.$2?.statusCode, equals(200), reason: 'Expected 200 Ok');
@@ -133,7 +121,6 @@ void main() {
final stream = await streamHttpRequest(
'empty_url_test',
APIType.rest,
null,
model,
);
final output = await stream.first;
@@ -149,7 +136,6 @@ void main() {
final stream = await streamHttpRequest(
'invalid_url_test',
APIType.rest,
null,
model,
);
final output = await stream.first;
@@ -170,7 +156,6 @@ void main() {
final stream = await streamHttpRequest(
'large_body_test',
APIType.rest,
null,
model,
);
final output = await stream.first;
@@ -199,12 +184,7 @@ void main() {
cancelHttpRequest('get_test_c');
});
debugPrint("Stream start");
final stream = await streamHttpRequest(
'get_test_c',
APIType.rest,
null,
model,
);
final stream = await streamHttpRequest('get_test_c', APIType.rest, model);
debugPrint("Stream get output");
final output = await stream.first;
final errMsg = output?.$4;

View File

@@ -13,12 +13,7 @@ void main() {
method: HTTPVerb.get,
);
final stream = await streamHttpRequest(
'sse_test',
APIType.rest,
null,
model,
);
final stream = await streamHttpRequest('sse_test', APIType.rest, model);
final outputs = <HttpStreamOutput?>[];
final subscription = stream.listen(outputs.add);
@@ -44,12 +39,7 @@ void main() {
method: HTTPVerb.get,
);
final stream = await streamHttpRequest(
'sse_test',
APIType.rest,
null,
model,
);
final stream = await streamHttpRequest('sse_test', APIType.rest, model);
final outputs = <HttpStreamOutput?>[];
final subscription = stream.listen(outputs.add);

View File

@@ -14,7 +14,6 @@ void main() {
final result = await sendHttpRequest(
'test-request',
APIType.rest,
null,
httpRequestModel,
);