mirror of
https://github.com/foss42/apidash.git
synced 2025-12-04 03:46:57 +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:
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ void main() {
|
||||
final result = await sendHttpRequest(
|
||||
'test-request',
|
||||
APIType.rest,
|
||||
null,
|
||||
httpRequestModel,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user