diff --git a/lib/codegen/dart/pkg_http.dart b/lib/codegen/dart/pkg_http.dart index a56ab2c3..2c0e016c 100644 --- a/lib/codegen/dart/pkg_http.dart +++ b/lib/codegen/dart/pkg_http.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'dart:convert'; import 'package:jinja/jinja.dart' as jj; import 'package:apidash/consts.dart'; -import 'package:apidash/utils/utils.dart' show padMultilineString, rowsToMap; +import 'package:apidash/utils/utils.dart' show padMultilineString; import 'package:apidash/models/models.dart' show RequestModel; class DartHttpCodeGen { @@ -85,7 +85,7 @@ void main() async { var paramsList = requestModel.requestParams; if (paramsList != null) { - var params = rowsToMap(requestModel.requestParams) ?? {}; + var params = requestModel.paramsMap; if (params.isNotEmpty) { var templateParams = jj.Template(kTemplateParams); var paramsString = kEncoder.convert(params); @@ -113,7 +113,7 @@ void main() async { var headersList = requestModel.requestHeaders; if (headersList != null || hasBody) { - var headers = rowsToMap(requestModel.requestHeaders) ?? {}; + var headers = requestModel.headersMap; if (headers.isNotEmpty || hasBody) { hasHeaders = true; if (hasBody) { diff --git a/lib/codegen/kotlin/pkg_okhttp.dart b/lib/codegen/kotlin/pkg_okhttp.dart index c33c7ce4..0dc8c5b1 100644 --- a/lib/codegen/kotlin/pkg_okhttp.dart +++ b/lib/codegen/kotlin/pkg_okhttp.dart @@ -1,7 +1,7 @@ import 'dart:convert'; import 'package:apidash/consts.dart'; import 'package:jinja/jinja.dart' as jj; -import 'package:apidash/utils/utils.dart' show getValidRequestUri, rowsToMap; +import 'package:apidash/utils/utils.dart' show getValidRequestUri; import '../../models/request_model.dart'; class KotlinOkHttpCodeGen { @@ -121,7 +121,7 @@ import okhttp3.MediaType.Companion.toMediaType"""; var headersList = requestModel.requestHeaders; if (headersList != null) { - var headers = rowsToMap(requestModel.requestHeaders) ?? {}; + var headers = requestModel.headersMap; if (headers.isNotEmpty) { hasHeaders = true; result += getHeaders(headers); diff --git a/lib/codegen/python/pkg_http_client.dart b/lib/codegen/python/pkg_http_client.dart index 35f30ab3..83d02676 100644 --- a/lib/codegen/python/pkg_http_client.dart +++ b/lib/codegen/python/pkg_http_client.dart @@ -3,7 +3,7 @@ import 'dart:convert'; import 'package:jinja/jinja.dart' as jj; import 'package:apidash/consts.dart'; import 'package:apidash/utils/utils.dart' - show getValidRequestUri, padMultilineString, rowsToMap; + show getValidRequestUri, padMultilineString; import 'package:apidash/models/models.dart' show RequestModel; class PythonHttpClientCodeGen { @@ -99,7 +99,7 @@ print(data.decode("utf-8")) var headersList = requestModel.requestHeaders; if (headersList != null || hasBody) { - var headers = rowsToMap(requestModel.requestHeaders) ?? {}; + var headers = requestModel.headersMap; if (headers.isNotEmpty || hasBody) { hasHeaders = true; if (hasBody) { diff --git a/lib/codegen/python/pkg_requests.dart b/lib/codegen/python/pkg_requests.dart index a98ace19..86905b62 100644 --- a/lib/codegen/python/pkg_requests.dart +++ b/lib/codegen/python/pkg_requests.dart @@ -3,7 +3,7 @@ import 'dart:convert'; import 'package:jinja/jinja.dart' as jj; import 'package:apidash/consts.dart'; import 'package:apidash/utils/utils.dart' - show getValidRequestUri, padMultilineString, rowsToMap; + show getValidRequestUri, padMultilineString; import 'package:apidash/models/models.dart' show RequestModel; class PythonRequestsCodeGen { @@ -112,7 +112,7 @@ print('Response Body:', response.text) var headersList = requestModel.requestHeaders; if (headersList != null || hasBody) { - var headers = rowsToMap(requestModel.requestHeaders) ?? {}; + var headers = requestModel.headersMap; if (headers.isNotEmpty || hasBody) { hasHeaders = true; if (hasBody) { diff --git a/lib/services/http_service.dart b/lib/services/http_service.dart index 1f736d6d..8265a299 100644 --- a/lib/services/http_service.dart +++ b/lib/services/http_service.dart @@ -17,7 +17,7 @@ Future<(http.Response?, Duration?, String?)> request( ); if (uriRec.$1 != null) { Uri requestUrl = uriRec.$1!; - Map headers = rowsToMap(requestModel.requestHeaders) ?? {}; + Map headers = requestModel.headersMap; http.Response response; String? body; try { diff --git a/lib/utils/har_utils.dart b/lib/utils/har_utils.dart index d30b8a66..c2a187f3 100644 --- a/lib/utils/har_utils.dart +++ b/lib/utils/har_utils.dart @@ -1,6 +1,6 @@ import 'dart:convert'; import 'package:apidash/consts.dart'; -import 'package:apidash/utils/utils.dart' show rowsToMap, getValidRequestUri; +import 'package:apidash/utils/utils.dart' show getValidRequestUri; import 'package:apidash/models/models.dart' show RequestModel; import 'package:package_info_plus/package_info_plus.dart'; @@ -99,7 +99,7 @@ Map requestModelToHARJsonRequest( var paramsList = requestModel.requestParams; if (paramsList != null) { - var params = rowsToMap(requestModel.requestParams) ?? {}; + var params = requestModel.paramsMap; if (params.isNotEmpty) { for (final k in params.keys) { var m = {"name": k, "value": params[k]}; @@ -129,7 +129,7 @@ Map requestModelToHARJsonRequest( var headersList = requestModel.requestHeaders; if (headersList != null || hasBody) { - var headers = rowsToMap(requestModel.requestHeaders) ?? {}; + var headers = requestModel.headersMap; if (headers.isNotEmpty || hasBody) { if (hasBody) { var m = {