mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 18:28:25 +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:
@@ -54,10 +54,10 @@ class _BetterNetworkingExampleState extends State<BetterNetworkingExample> {
|
||||
final (resp, duration, err) = await sendHttpRequest(
|
||||
'G1',
|
||||
APIType.rest,
|
||||
AuthModel(type: APIAuthType.none),
|
||||
HttpRequestModel(
|
||||
url: 'https://reqres.in/api/users/2',
|
||||
method: HTTPVerb.get,
|
||||
authModel: AuthModel(type: APIAuthType.none),
|
||||
headers: [
|
||||
NameValueModel(
|
||||
name: 'x-api-key',
|
||||
@@ -81,10 +81,10 @@ class _BetterNetworkingExampleState extends State<BetterNetworkingExample> {
|
||||
final (resp, duration, err) = await sendHttpRequest(
|
||||
'P1',
|
||||
APIType.rest,
|
||||
AuthModel(type: APIAuthType.none),
|
||||
HttpRequestModel(
|
||||
url: 'https://reqres.in/api/users',
|
||||
method: HTTPVerb.post,
|
||||
authModel: AuthModel(type: APIAuthType.none),
|
||||
headers: [
|
||||
NameValueModel(
|
||||
name: 'x-api-key',
|
||||
@@ -109,10 +109,10 @@ class _BetterNetworkingExampleState extends State<BetterNetworkingExample> {
|
||||
final stream = await streamHttpRequest(
|
||||
'S1',
|
||||
APIType.rest,
|
||||
null,
|
||||
HttpRequestModel(
|
||||
method: HTTPVerb.post,
|
||||
url: 'http://localhost:11434/v1/chat/completions',
|
||||
authModel: null,
|
||||
body: jsonEncode({
|
||||
'model': 'gemma3:latest',
|
||||
'stream': true,
|
||||
|
||||
Reference in New Issue
Block a user