mirror of
https://github.com/foss42/apidash.git
synced 2025-05-26 10:46:40 +08:00
Merge branch 'main' into fix-kotlin-codegen-import-issue
This commit is contained in:
1
.github/pull_request_template.md
vendored
1
.github/pull_request_template.md
vendored
@ -16,4 +16,3 @@ _We encourage you to add relevant test cases._
|
|||||||
|
|
||||||
- [ ] Yes
|
- [ ] Yes
|
||||||
- [ ] No, and this is why: _please replace this line with details on why tests have not been included_
|
- [ ] No, and this is why: _please replace this line with details on why tests have not been included_
|
||||||
- [ ] I need help with writing tests
|
|
||||||
|
@ -128,3 +128,23 @@ flutter test test/widgets/codegen_previewer_test.dart
|
|||||||
### How to add a new package to pubspec.yaml?
|
### How to add a new package to pubspec.yaml?
|
||||||
|
|
||||||
Instead of copy pasting from pub.dev, it is recommended that you use `flutter pub add package_name` to add a new package to `pubspec.yaml`. You can read more [here](https://docs.flutter.dev/packages-and-plugins/using-packages#adding-a-package-dependency-to-an-app-using-flutter-pub-add).
|
Instead of copy pasting from pub.dev, it is recommended that you use `flutter pub add package_name` to add a new package to `pubspec.yaml`. You can read more [here](https://docs.flutter.dev/packages-and-plugins/using-packages#adding-a-package-dependency-to-an-app-using-flutter-pub-add).
|
||||||
|
|
||||||
|
## Troubleshooting Common Issues
|
||||||
|
|
||||||
|
### Network Connection Issues on macOS
|
||||||
|
|
||||||
|
If you encounter a network connection error similar to the following while running your Flutter app on macOS:
|
||||||
|
|
||||||
|
```
|
||||||
|
ClientException with SocketException: Connection failed (OS Error: Operation not permitted, errno = 1)
|
||||||
|
```
|
||||||
|
Add below key to `macos/Runner/DebugProfile.entitlements` and `macos/Runner/Release.entitlements`.
|
||||||
|
|
||||||
|
```
|
||||||
|
<key>com.apple.security.network.client</key>
|
||||||
|
<true/>
|
||||||
|
```
|
||||||
|
|
||||||
|
You can read more [here](https://docs.flutter.dev/platform-integration/macos/building#setting-up-entitlements)
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ Here is the complete list of mimetypes that can be directly previewed in API Das
|
|||||||
| File Type | Mimetype | Extension | Comment |
|
| File Type | Mimetype | Extension | Comment |
|
||||||
| --------- | -------------------------- | ----------------- | -------- |
|
| --------- | -------------------------- | ----------------- | -------- |
|
||||||
| PDF | `application/pdf` | `.pdf` | |
|
| PDF | `application/pdf` | `.pdf` | |
|
||||||
|
| CSV | `text/csv` | `.csv` | Can be improved |
|
||||||
| Image | `image/apng` | `.apng` | Animated |
|
| Image | `image/apng` | `.apng` | Animated |
|
||||||
| Image | `image/avif` | `.avif` | |
|
| Image | `image/avif` | `.avif` | |
|
||||||
| Image | `image/bmp` | `.bmp` | |
|
| Image | `image/bmp` | `.bmp` | |
|
||||||
|
@ -3,8 +3,9 @@ include: package:flutter_lints/flutter.yaml
|
|||||||
analyzer:
|
analyzer:
|
||||||
errors:
|
errors:
|
||||||
invalid_annotation_target: ignore
|
invalid_annotation_target: ignore
|
||||||
enable-experiment:
|
exclude:
|
||||||
- records
|
- "**/*.freezed.dart"
|
||||||
|
- "**/*.g.dart"
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
rules:
|
rules:
|
||||||
|
@ -378,6 +378,7 @@ const Map<String, Map<String, List<ResponseBodyView>>>
|
|||||||
kSubTypeDefaultViewOptions: kRawBodyViewOptions,
|
kSubTypeDefaultViewOptions: kRawBodyViewOptions,
|
||||||
kSubTypeCss: kCodeRawBodyViewOptions,
|
kSubTypeCss: kCodeRawBodyViewOptions,
|
||||||
kSubTypeHtml: kCodeRawBodyViewOptions,
|
kSubTypeHtml: kCodeRawBodyViewOptions,
|
||||||
|
kSubTypeCsv: kPreviewRawBodyViewOptions,
|
||||||
kSubTypeJavascript: kCodeRawBodyViewOptions,
|
kSubTypeJavascript: kCodeRawBodyViewOptions,
|
||||||
kSubTypeMarkdown: kCodeRawBodyViewOptions,
|
kSubTypeMarkdown: kCodeRawBodyViewOptions,
|
||||||
kSubTypeTextXml: kCodeRawBodyViewOptions,
|
kSubTypeTextXml: kCodeRawBodyViewOptions,
|
||||||
@ -495,7 +496,11 @@ const kAudioError =
|
|||||||
const kRaiseIssue =
|
const kRaiseIssue =
|
||||||
"\nPlease raise an issue in API Dash GitHub repo so that we can resolve it.";
|
"\nPlease raise an issue in API Dash GitHub repo so that we can resolve it.";
|
||||||
|
|
||||||
const kHintTextUrlCard = "Enter API endpoint like api.foss42.com/country/codes";
|
const kCsvError =
|
||||||
|
"There seems to be an issue rendering this CSV. Please raise an issue in API Dash GitHub repo so that we can resolve it.";
|
||||||
|
|
||||||
|
const kHintTextUrlCard =
|
||||||
|
"Enter API endpoint like api.apidash.dev/country/codes";
|
||||||
const kLabelPlusNew = "+ New";
|
const kLabelPlusNew = "+ New";
|
||||||
const kLabelSend = "Send";
|
const kLabelSend = "Send";
|
||||||
const kLabelSending = "Sending..";
|
const kLabelSending = "Sending..";
|
||||||
|
@ -29,6 +29,7 @@ class RequestModel {
|
|||||||
this.responseStatus,
|
this.responseStatus,
|
||||||
this.message,
|
this.message,
|
||||||
this.responseModel,
|
this.responseModel,
|
||||||
|
this.isWorking = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String id;
|
final String id;
|
||||||
@ -47,6 +48,7 @@ class RequestModel {
|
|||||||
final int? responseStatus;
|
final int? responseStatus;
|
||||||
final String? message;
|
final String? message;
|
||||||
final ResponseModel? responseModel;
|
final ResponseModel? responseModel;
|
||||||
|
final bool isWorking;
|
||||||
|
|
||||||
List<NameValueModel>? get enabledRequestHeaders =>
|
List<NameValueModel>? get enabledRequestHeaders =>
|
||||||
getEnabledRows(requestHeaders, isHeaderEnabledList);
|
getEnabledRows(requestHeaders, isHeaderEnabledList);
|
||||||
@ -106,6 +108,7 @@ class RequestModel {
|
|||||||
int? responseStatus,
|
int? responseStatus,
|
||||||
String? message,
|
String? message,
|
||||||
ResponseModel? responseModel,
|
ResponseModel? responseModel,
|
||||||
|
bool? isWorking,
|
||||||
}) {
|
}) {
|
||||||
var headers = requestHeaders ?? this.requestHeaders;
|
var headers = requestHeaders ?? this.requestHeaders;
|
||||||
var params = requestParams ?? this.requestParams;
|
var params = requestParams ?? this.requestParams;
|
||||||
@ -129,6 +132,7 @@ class RequestModel {
|
|||||||
responseStatus: responseStatus ?? this.responseStatus,
|
responseStatus: responseStatus ?? this.responseStatus,
|
||||||
message: message ?? this.message,
|
message: message ?? this.message,
|
||||||
responseModel: responseModel ?? this.responseModel,
|
responseModel: responseModel ?? this.responseModel,
|
||||||
|
isWorking: isWorking ?? this.isWorking,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,11 +156,20 @@ class CollectionStateNotifier
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> sendRequest(String id) async {
|
Future<void> sendRequest(String id) async {
|
||||||
ref.read(sentRequestIdStateProvider.notifier).state = id;
|
|
||||||
ref.read(codePaneVisibleStateProvider.notifier).state = false;
|
ref.read(codePaneVisibleStateProvider.notifier).state = false;
|
||||||
final defaultUriScheme =
|
final defaultUriScheme = ref.read(
|
||||||
ref.read(settingsProvider.select((value) => value.defaultUriScheme));
|
settingsProvider.select(
|
||||||
|
(value) => value.defaultUriScheme,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
RequestModel requestModel = state![id]!;
|
RequestModel requestModel = state![id]!;
|
||||||
|
|
||||||
|
// set current model's isWorking to true and update state
|
||||||
|
var map = {...state!};
|
||||||
|
map[id] = requestModel.copyWith(isWorking: true);
|
||||||
|
state = map;
|
||||||
|
|
||||||
(http.Response?, Duration?, String?)? responseRec = await request(
|
(http.Response?, Duration?, String?)? responseRec = await request(
|
||||||
requestModel,
|
requestModel,
|
||||||
defaultUriScheme: defaultUriScheme,
|
defaultUriScheme: defaultUriScheme,
|
||||||
@ -172,6 +181,7 @@ class CollectionStateNotifier
|
|||||||
newRequestModel = requestModel.copyWith(
|
newRequestModel = requestModel.copyWith(
|
||||||
responseStatus: -1,
|
responseStatus: -1,
|
||||||
message: responseRec.$3,
|
message: responseRec.$3,
|
||||||
|
isWorking: false,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
final responseModel = baseResponseModel.fromResponse(
|
final responseModel = baseResponseModel.fromResponse(
|
||||||
@ -183,10 +193,12 @@ class CollectionStateNotifier
|
|||||||
responseStatus: statusCode,
|
responseStatus: statusCode,
|
||||||
message: kResponseCodeReasons[statusCode],
|
message: kResponseCodeReasons[statusCode],
|
||||||
responseModel: responseModel,
|
responseModel: responseModel,
|
||||||
|
isWorking: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
ref.read(sentRequestIdStateProvider.notifier).state = null;
|
|
||||||
var map = {...state!};
|
// update state with response data
|
||||||
|
map = {...state!};
|
||||||
map[id] = newRequestModel;
|
map[id] = newRequestModel;
|
||||||
state = map;
|
state = map;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
|
|
||||||
final navRailIndexStateProvider = StateProvider<int>((ref) => 0);
|
final navRailIndexStateProvider = StateProvider<int>((ref) => 0);
|
||||||
final selectedIdEditStateProvider = StateProvider<String?>((ref) => null);
|
final selectedIdEditStateProvider = StateProvider<String?>((ref) => null);
|
||||||
final sentRequestIdStateProvider = StateProvider<String?>((ref) => null);
|
|
||||||
final codePaneVisibleStateProvider = StateProvider<bool>((ref) => false);
|
final codePaneVisibleStateProvider = StateProvider<bool>((ref) => false);
|
||||||
final saveDataStateProvider = StateProvider<bool>((ref) => false);
|
final saveDataStateProvider = StateProvider<bool>((ref) => false);
|
||||||
final clearDataStateProvider = StateProvider<bool>((ref) => false);
|
final clearDataStateProvider = StateProvider<bool>((ref) => false);
|
||||||
|
@ -9,13 +9,14 @@ class ResponsePane extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final selectedId = ref.watch(selectedIdStateProvider);
|
final isWorking = ref.watch(
|
||||||
final sentRequestId = ref.watch(sentRequestIdStateProvider);
|
selectedRequestModelProvider.select((value) => value?.isWorking)) ??
|
||||||
|
false;
|
||||||
final responseStatus = ref.watch(
|
final responseStatus = ref.watch(
|
||||||
selectedRequestModelProvider.select((value) => value?.responseStatus));
|
selectedRequestModelProvider.select((value) => value?.responseStatus));
|
||||||
final message = ref
|
final message = ref
|
||||||
.watch(selectedRequestModelProvider.select((value) => value?.message));
|
.watch(selectedRequestModelProvider.select((value) => value?.message));
|
||||||
if (sentRequestId != null && sentRequestId == selectedId) {
|
if (isWorking) {
|
||||||
return const SendingWidget();
|
return const SendingWidget();
|
||||||
}
|
}
|
||||||
if (responseStatus == null) {
|
if (responseStatus == null) {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:apidash/providers/collection_providers.dart';
|
||||||
import 'package:apidash/consts.dart';
|
import 'package:apidash/consts.dart';
|
||||||
import 'details_card/details_card.dart';
|
import 'details_card/details_card.dart';
|
||||||
import 'url_card.dart';
|
import 'url_card.dart';
|
||||||
@ -10,6 +12,7 @@ class RequestEditor extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Column(
|
return const Column(
|
||||||
children: [
|
children: [
|
||||||
|
RequestEditorTopBar(),
|
||||||
EditorPaneRequestURLCard(),
|
EditorPaneRequestURLCard(),
|
||||||
kVSpacer10,
|
kVSpacer10,
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -19,3 +22,91 @@ class RequestEditor extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RequestEditorTopBar extends ConsumerWidget {
|
||||||
|
const RequestEditorTopBar({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final id = ref.watch(selectedIdStateProvider);
|
||||||
|
final name =
|
||||||
|
ref.watch(selectedRequestModelProvider.select((value) => value?.name));
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 12.0,
|
||||||
|
top: 4.0,
|
||||||
|
right: 8.0,
|
||||||
|
bottom: 4.0,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
name ?? "",
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 6,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 90,
|
||||||
|
height: 24,
|
||||||
|
child: FilledButton.tonalIcon(
|
||||||
|
style: const ButtonStyle(
|
||||||
|
padding: MaterialStatePropertyAll(EdgeInsets.zero),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
final controller =
|
||||||
|
TextEditingController(text: name ?? "");
|
||||||
|
controller.selection = TextSelection(
|
||||||
|
baseOffset: 0, extentOffset: controller.text.length);
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('Rename Request'),
|
||||||
|
content: TextField(
|
||||||
|
autofocus: true,
|
||||||
|
controller: controller,
|
||||||
|
decoration:
|
||||||
|
const InputDecoration(hintText: "Enter new name"),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
OutlinedButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: const Text('CANCEL')),
|
||||||
|
FilledButton(
|
||||||
|
onPressed: () {
|
||||||
|
final val = controller.text.trim();
|
||||||
|
ref
|
||||||
|
.read(collectionStateNotifierProvider
|
||||||
|
.notifier)
|
||||||
|
.update(id!, name: val);
|
||||||
|
Navigator.pop(context);
|
||||||
|
controller.dispose();
|
||||||
|
},
|
||||||
|
child: const Text('OK')),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.edit,
|
||||||
|
size: 12,
|
||||||
|
),
|
||||||
|
label: Text(
|
||||||
|
"Rename",
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -81,6 +81,11 @@ class URLTextField extends ConsumerWidget {
|
|||||||
.read(collectionStateNotifierProvider.notifier)
|
.read(collectionStateNotifierProvider.notifier)
|
||||||
.update(selectedId, url: value);
|
.update(selectedId, url: value);
|
||||||
},
|
},
|
||||||
|
onFieldSubmitted: (value) {
|
||||||
|
ref
|
||||||
|
.read(collectionStateNotifierProvider.notifier)
|
||||||
|
.sendRequest(selectedId);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,10 +98,11 @@ class SendButton extends ConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final selectedId = ref.watch(selectedIdStateProvider);
|
final selectedId = ref.watch(selectedIdStateProvider);
|
||||||
final sentRequestId = ref.watch(sentRequestIdStateProvider);
|
final isWorking = ref.watch(
|
||||||
|
selectedRequestModelProvider.select((value) => value?.isWorking));
|
||||||
|
|
||||||
return SendRequestButton(
|
return SendRequestButton(
|
||||||
selectedId: selectedId,
|
isWorking: isWorking ?? false,
|
||||||
sentRequestId: sentRequestId,
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ref
|
ref
|
||||||
.read(collectionStateNotifierProvider.notifier)
|
.read(collectionStateNotifierProvider.notifier)
|
||||||
|
@ -65,7 +65,7 @@ class SettingsPage extends ConsumerWidget {
|
|||||||
hoverColor: kColorTransparent,
|
hoverColor: kColorTransparent,
|
||||||
title: const Text('Default URI Scheme'),
|
title: const Text('Default URI Scheme'),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'api.foss42.com → ${settings.defaultUriScheme}://api.foss42.com'),
|
'api.apidash.dev → ${settings.defaultUriScheme}://api.apidash.dev'),
|
||||||
trailing: DropdownMenu(
|
trailing: DropdownMenu(
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
ref
|
ref
|
||||||
|
@ -43,7 +43,7 @@ String getShortPath(String path) {
|
|||||||
var f = p.split(path);
|
var f = p.split(path);
|
||||||
if (f.length > 2) {
|
if (f.length > 2) {
|
||||||
f = f.sublist(f.length - 2);
|
f = f.sublist(f.length - 2);
|
||||||
return ".../${p.joinAll(f)}";
|
return p.join("...", p.joinAll(f));
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ Map<String, String> headers = {
|
|||||||
"Accept": "Specifies the media types that are acceptable for the response.",
|
"Accept": "Specifies the media types that are acceptable for the response.",
|
||||||
"Accept-Encoding":
|
"Accept-Encoding":
|
||||||
"Indicates the encoding methods the client can understand.",
|
"Indicates the encoding methods the client can understand.",
|
||||||
|
"Accept-Charset": "Specifies the character sets that are acceptable.",
|
||||||
"Access-Control-Allow-Headers":
|
"Access-Control-Allow-Headers":
|
||||||
"Specifies a list of HTTP headers that can be used in an actual request after a preflight request including the Access-Control-Request-Headers header is made.",
|
"Specifies a list of HTTP headers that can be used in an actual request after a preflight request including the Access-Control-Request-Headers header is made.",
|
||||||
"Access-Control-Allow-Methods":
|
"Access-Control-Allow-Methods":
|
||||||
@ -41,11 +42,16 @@ Map<String, String> headers = {
|
|||||||
"Cross-Origin-Resource-Policy":
|
"Cross-Origin-Resource-Policy":
|
||||||
"Controls how cross-origin requests for resources are handled.",
|
"Controls how cross-origin requests for resources are handled.",
|
||||||
"Date": "Indicates the date and time at which the message was sent.",
|
"Date": "Indicates the date and time at which the message was sent.",
|
||||||
|
"Device-Memory":
|
||||||
|
"Indicates the approximate amount of device memory in gigabytes.",
|
||||||
"DNT":
|
"DNT":
|
||||||
"Informs websites whether the user's preference is to opt out of online tracking.",
|
"Informs websites whether the user's preference is to opt out of online tracking.",
|
||||||
"Expect": "Indicates certain expectations that need to be met by the server.",
|
"Expect": "Indicates certain expectations that need to be met by the server.",
|
||||||
"Expires":
|
"Expires":
|
||||||
"Contains the date/time after which the response is considered expired",
|
"Contains the date/time after which the response is considered expired",
|
||||||
|
"Forwarded":
|
||||||
|
"Contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request.",
|
||||||
|
"From": "Contains an Internet email address for a human user who controls the requesting user agent.",
|
||||||
"Host": "Specifies the domain name of the server and the port number.",
|
"Host": "Specifies the domain name of the server and the port number.",
|
||||||
"If-Match":
|
"If-Match":
|
||||||
"Used for conditional requests, allows the server to respond based on certain conditions.",
|
"Used for conditional requests, allows the server to respond based on certain conditions.",
|
||||||
@ -57,9 +63,15 @@ Map<String, String> headers = {
|
|||||||
"Used in conjunction with the Range header to conditionally request a partial resource.",
|
"Used in conjunction with the Range header to conditionally request a partial resource.",
|
||||||
"If-Unmodified-Since":
|
"If-Unmodified-Since":
|
||||||
"Used for conditional requests, allows the server to respond based on certain conditions.",
|
"Used for conditional requests, allows the server to respond based on certain conditions.",
|
||||||
|
"Keep-Alive":
|
||||||
|
"Used to allow the connection to be reused for further requests.",
|
||||||
"Location":
|
"Location":
|
||||||
"Indicates the URL a client should redirect to for further interaction.",
|
"Indicates the URL a client should redirect to for further interaction.",
|
||||||
|
"Max-Forwards":
|
||||||
|
"Indicates the remaining number of times a request can be forwarded by proxies.",
|
||||||
"Origin": "Specifies the origin of a cross-origin request.",
|
"Origin": "Specifies the origin of a cross-origin request.",
|
||||||
|
"Proxy-Authorization":
|
||||||
|
"Contains credentials for authenticating a client with a proxy server.",
|
||||||
"Range":
|
"Range":
|
||||||
"Used to request only part of a resource, typically in the context of downloading large files.",
|
"Used to request only part of a resource, typically in the context of downloading large files.",
|
||||||
"Referer":
|
"Referer":
|
||||||
@ -68,10 +80,14 @@ Map<String, String> headers = {
|
|||||||
"Specifies how much information the browser should include in the Referer header when navigating to other pages.",
|
"Specifies how much information the browser should include in the Referer header when navigating to other pages.",
|
||||||
"Retry-After":
|
"Retry-After":
|
||||||
"Informs the client how long it should wait before making another request after a server has responded with a rate-limiting status code.",
|
"Informs the client how long it should wait before making another request after a server has responded with a rate-limiting status code.",
|
||||||
|
"Save-Data":
|
||||||
|
"Indicates the client's preference for reduced data usage.",
|
||||||
"Server": "Indicates the software used by the origin server.",
|
"Server": "Indicates the software used by the origin server.",
|
||||||
"Strict-Transport-Security":
|
"Strict-Transport-Security":
|
||||||
"Instructs the browser to always use HTTPS for the given domain.",
|
"Instructs the browser to always use HTTPS for the given domain.",
|
||||||
"TE": "Specifies the transfer encodings that are acceptable to the client.",
|
"TE": "Specifies the transfer encodings that are acceptable to the client.",
|
||||||
|
"Upgrade-Insecure-Requests":
|
||||||
|
"Instructs the browser to prefer secure connections when available.",
|
||||||
"User-Agent":
|
"User-Agent":
|
||||||
"Identifies the client software and version making the request.",
|
"Identifies the client software and version making the request.",
|
||||||
"Via":
|
"Via":
|
||||||
|
@ -47,32 +47,33 @@ class CopyButton extends StatelessWidget {
|
|||||||
class SendRequestButton extends StatelessWidget {
|
class SendRequestButton extends StatelessWidget {
|
||||||
const SendRequestButton({
|
const SendRequestButton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.selectedId,
|
required this.isWorking,
|
||||||
required this.sentRequestId,
|
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String? selectedId;
|
final bool isWorking;
|
||||||
final String? sentRequestId;
|
|
||||||
final void Function() onTap;
|
final void Function() onTap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
bool disable = sentRequestId != null;
|
|
||||||
return FilledButton(
|
return FilledButton(
|
||||||
onPressed: disable ? null : onTap,
|
onPressed: isWorking ? null : onTap,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: isWorking
|
||||||
|
? const [
|
||||||
Text(
|
Text(
|
||||||
disable
|
kLabelSending,
|
||||||
? (selectedId == sentRequestId ? kLabelSending : kLabelBusy)
|
|
||||||
: kLabelSend,
|
|
||||||
style: kTextStyleButton,
|
style: kTextStyleButton,
|
||||||
),
|
),
|
||||||
if (!disable) kHSpacer10,
|
]
|
||||||
if (!disable)
|
: const [
|
||||||
const Icon(
|
Text(
|
||||||
|
kLabelSend,
|
||||||
|
style: kTextStyleButton,
|
||||||
|
),
|
||||||
|
kHSpacer10,
|
||||||
|
Icon(
|
||||||
size: 16,
|
size: 16,
|
||||||
Icons.send,
|
Icons.send,
|
||||||
),
|
),
|
||||||
|
@ -97,6 +97,9 @@ class SidebarRequestCard extends StatelessWidget {
|
|||||||
onTapOutsideNameEditor?.call();
|
onTapOutsideNameEditor?.call();
|
||||||
//FocusScope.of(context).unfocus();
|
//FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
|
onFieldSubmitted: (value) {
|
||||||
|
onTapOutsideNameEditor?.call();
|
||||||
|
},
|
||||||
onChanged: onChangedNameEditor,
|
onChanged: onChangedNameEditor,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
isCollapsed: true,
|
isCollapsed: true,
|
||||||
|
53
lib/widgets/csv_previewer.dart
Normal file
53
lib/widgets/csv_previewer.dart
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:csv/csv.dart';
|
||||||
|
import 'error_message.dart';
|
||||||
|
import '../consts.dart';
|
||||||
|
|
||||||
|
class CsvPreviewer extends StatelessWidget {
|
||||||
|
const CsvPreviewer({super.key, required this.body});
|
||||||
|
|
||||||
|
final String body;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
try {
|
||||||
|
final List<List<dynamic>> csvData =
|
||||||
|
const CsvToListConverter().convert(body, eol: '\n');
|
||||||
|
return SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
columns: csvData[0]
|
||||||
|
.map(
|
||||||
|
(item) => DataColumn(
|
||||||
|
label: Text(
|
||||||
|
item.toString(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
rows: csvData
|
||||||
|
.skip(1)
|
||||||
|
.map(
|
||||||
|
(csvrow) => DataRow(
|
||||||
|
cells: csvrow
|
||||||
|
.map(
|
||||||
|
(csvItem) => DataCell(
|
||||||
|
Text(
|
||||||
|
csvItem.toString(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
return const ErrorMessage(message: kCsvError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -52,6 +52,7 @@ class _FormDataFieldState extends State<FormDataField> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
hintText: widget.hintText,
|
hintText: widget.hintText,
|
||||||
|
contentPadding: const EdgeInsets.only(bottom: 16),
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: colorScheme.primary.withOpacity(
|
color: colorScheme.primary.withOpacity(
|
||||||
@ -71,7 +72,8 @@ class _FormDataFieldState extends State<FormDataField> {
|
|||||||
widget.onFormDataTypeChanged!(p0);
|
widget.onFormDataTypeChanged!(p0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
onChanged: widget.onChanged,
|
onChanged: widget.onChanged,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
import 'package:apidash/consts.dart';
|
||||||
import 'package:apidash/utils/header_utils.dart';
|
import 'package:apidash/utils/header_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:apidash/consts.dart';
|
|
||||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||||
|
|
||||||
class HeaderField extends StatefulWidget {
|
class HeaderField extends StatefulWidget {
|
||||||
@ -41,6 +41,7 @@ class _HeaderFieldState extends State<HeaderField> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(HeaderField oldWidget) {
|
void didUpdateWidget(HeaderField oldWidget) {
|
||||||
|
super.didUpdateWidget(oldWidget);
|
||||||
if (oldWidget.initialValue != widget.initialValue) {
|
if (oldWidget.initialValue != widget.initialValue) {
|
||||||
controller.text = widget.initialValue ?? "";
|
controller.text = widget.initialValue ?? "";
|
||||||
controller.selection =
|
controller.selection =
|
||||||
@ -54,8 +55,8 @@ class _HeaderFieldState extends State<HeaderField> {
|
|||||||
return TypeAheadField(
|
return TypeAheadField(
|
||||||
key: Key(widget.keyId),
|
key: Key(widget.keyId),
|
||||||
hideOnEmpty: true,
|
hideOnEmpty: true,
|
||||||
minCharsForSuggestions: 1,
|
controller: controller,
|
||||||
onSuggestionSelected: (value) {
|
onSelected: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
controller.text = value;
|
controller.text = value;
|
||||||
});
|
});
|
||||||
@ -68,19 +69,17 @@ class _HeaderFieldState extends State<HeaderField> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
suggestionsCallback: headerSuggestionCallback,
|
suggestionsCallback: headerSuggestionCallback,
|
||||||
suggestionsBoxDecoration: suggestionBoxDecorations(context),
|
decorationBuilder: (context, child) =>
|
||||||
textFieldConfiguration: TextFieldConfiguration(
|
suggestionBoxDecorations(context, child, colorScheme),
|
||||||
|
constraints: const BoxConstraints(maxHeight: 400),
|
||||||
|
builder: (context, controller, focusNode) => TextField(
|
||||||
onChanged: widget.onChanged,
|
onChanged: widget.onChanged,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
style: kCodeStyle.copyWith(
|
focusNode: focusNode,
|
||||||
color: colorScheme.onSurface,
|
style: kCodeStyle.copyWith(color: colorScheme.onSurface),
|
||||||
),
|
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintStyle: kCodeStyle.copyWith(
|
hintStyle: kCodeStyle.copyWith(
|
||||||
color: colorScheme.outline.withOpacity(
|
color: colorScheme.outline.withOpacity(kHintOpacity)),
|
||||||
kHintOpacity,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
hintText: widget.hintText,
|
hintText: widget.hintText,
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
@ -99,22 +98,26 @@ class _HeaderFieldState extends State<HeaderField> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SuggestionsBoxDecoration suggestionBoxDecorations(BuildContext context) {
|
Theme suggestionBoxDecorations(
|
||||||
return SuggestionsBoxDecoration(
|
BuildContext context, Widget child, ColorScheme colorScheme) {
|
||||||
|
return Theme(
|
||||||
|
data: ThemeData(colorScheme: colorScheme),
|
||||||
|
child: Material(
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
constraints: const BoxConstraints(maxHeight: 400),
|
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
side: BorderSide(
|
side: BorderSide(color: Theme.of(context).dividerColor, width: 1.2),
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.2,
|
|
||||||
),
|
|
||||||
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(8)),
|
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(8)),
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<String>> headerSuggestionCallback(String pattern) async {
|
Future<List<String>?> headerSuggestionCallback(String pattern) async {
|
||||||
|
if (pattern.isEmpty) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return getHeaderSuggestions(pattern);
|
return getHeaderSuggestions(pattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,7 @@ class _JsonPreviewerState extends State<JsonPreviewer> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(JsonPreviewer oldWidget) {
|
void didUpdateWidget(JsonPreviewer oldWidget) {
|
||||||
|
super.didUpdateWidget(oldWidget);
|
||||||
if (oldWidget.code != widget.code) {
|
if (oldWidget.code != widget.code) {
|
||||||
store.buildNodes(widget.code, areAllCollapsed: true);
|
store.buildNodes(widget.code, areAllCollapsed: true);
|
||||||
store.expandAll();
|
store.expandAll();
|
||||||
|
@ -9,9 +9,12 @@ class CustomMarkdown extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.data,
|
required this.data,
|
||||||
this.padding = const EdgeInsets.all(16.0),
|
this.padding = const EdgeInsets.all(16.0),
|
||||||
|
this.onTapLink,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String data;
|
final String data;
|
||||||
final EdgeInsets padding;
|
final EdgeInsets padding;
|
||||||
|
final void Function(String text, String? href, String title)? onTapLink;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -25,7 +28,8 @@ class CustomMarkdown extends StatelessWidget {
|
|||||||
data: data,
|
data: data,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
extensionSet: md.ExtensionSet.gitHubFlavored,
|
extensionSet: md.ExtensionSet.gitHubFlavored,
|
||||||
onTapLink: (text, href, title) {
|
onTapLink: onTapLink ??
|
||||||
|
(text, href, title) {
|
||||||
launchUrl(Uri.parse(href ?? ""));
|
launchUrl(Uri.parse(href ?? ""));
|
||||||
},
|
},
|
||||||
builders: {
|
builders: {
|
||||||
|
@ -7,6 +7,7 @@ import 'package:vector_graphics_compiler/vector_graphics_compiler.dart';
|
|||||||
import 'error_message.dart';
|
import 'error_message.dart';
|
||||||
import 'uint8_audio_player.dart';
|
import 'uint8_audio_player.dart';
|
||||||
import 'json_previewer.dart';
|
import 'json_previewer.dart';
|
||||||
|
import 'csv_previewer.dart';
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
|
|
||||||
class Previewer extends StatefulWidget {
|
class Previewer extends StatefulWidget {
|
||||||
@ -81,6 +82,9 @@ class _PreviewerState extends State<Previewer> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (widget.type == kTypeText && widget.subtype == kSubTypeCsv) {
|
||||||
|
return CsvPreviewer(body: widget.body);
|
||||||
|
}
|
||||||
if (widget.type == kTypeVideo) {
|
if (widget.type == kTypeVideo) {
|
||||||
// TODO: Video Player
|
// TODO: Video Player
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,13 @@ class URLField extends StatelessWidget {
|
|||||||
required this.selectedId,
|
required this.selectedId,
|
||||||
this.initialValue,
|
this.initialValue,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
|
this.onFieldSubmitted,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String selectedId;
|
final String selectedId;
|
||||||
final String? initialValue;
|
final String? initialValue;
|
||||||
final void Function(String)? onChanged;
|
final void Function(String)? onChanged;
|
||||||
|
final void Function(String)? onFieldSubmitted;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -29,6 +31,7 @@ class URLField extends StatelessWidget {
|
|||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
),
|
),
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
|
onFieldSubmitted: onFieldSubmitted,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +98,6 @@ class JsonSearchField extends StatelessWidget {
|
|||||||
controller: controller,
|
controller: controller,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
style: kCodeStyle,
|
style: kCodeStyle,
|
||||||
cursorHeight: 18,
|
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
|
102
pubspec.lock
102
pubspec.lock
@ -217,6 +217,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.3"
|
version: "3.0.3"
|
||||||
|
csv:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: csv
|
||||||
|
sha256: "63ed2871dd6471193dffc52c0e6c76fb86269c00244d244297abbb355c84a86e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.1.1"
|
||||||
dart_style:
|
dart_style:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -306,10 +314,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_keyboard_visibility
|
name: flutter_keyboard_visibility
|
||||||
sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb"
|
sha256: "98664be7be0e3ffca00de50f7f6a287ab62c763fc8c762e0a21584584a3ff4f8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.4.1"
|
version: "6.0.0"
|
||||||
flutter_keyboard_visibility_linux:
|
flutter_keyboard_visibility_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -407,10 +415,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_typeahead
|
name: flutter_typeahead
|
||||||
sha256: b9942bd5b7611a6ec3f0730c477146cffa4cd4b051077983ba67ddfc9e7ee818
|
sha256: d64712c65db240b1057559b952398ebb6e498077baeebf9b0731dade62438a6d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.8.0"
|
version: "5.2.0"
|
||||||
flutter_web_plugins:
|
flutter_web_plugins:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -500,10 +508,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: http
|
name: http
|
||||||
sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139
|
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.2"
|
version: "1.2.1"
|
||||||
http_multi_server:
|
http_multi_server:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -625,6 +633,30 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.2.0"
|
||||||
|
leak_tracker:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker
|
||||||
|
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "10.0.0"
|
||||||
|
leak_tracker_flutter_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_flutter_testing
|
||||||
|
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
|
leak_tracker_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_testing
|
||||||
|
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -661,26 +693,26 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.16"
|
version: "0.12.16+1"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.0"
|
version: "0.8.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
|
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.11.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -757,10 +789,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.3"
|
version: "1.9.0"
|
||||||
path_parsing:
|
path_parsing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -853,10 +885,34 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pointer_interceptor
|
name: pointer_interceptor
|
||||||
sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22
|
sha256: bd18321519718678d5fa98ad3a3359cbc7a31f018554eab80b73d08a7f0c165a
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.3+7"
|
version: "0.10.1"
|
||||||
|
pointer_interceptor_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_ios
|
||||||
|
sha256: "2e73c39452830adc4695757130676a39412a3b7f3c34e3f752791b5384770877"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.0+2"
|
||||||
|
pointer_interceptor_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_platform_interface
|
||||||
|
sha256: "0597b0560e14354baeb23f8375cd612e8bd4841bf8306ecb71fcd0bb78552506"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.0+1"
|
||||||
|
pointer_interceptor_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_web
|
||||||
|
sha256: a6237528b46c411d8d55cdfad8fcb3269fc4cbb26060b14bff94879165887d1e
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.2"
|
||||||
pointycastle:
|
pointycastle:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1178,10 +1234,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_web
|
name: url_launcher_web
|
||||||
sha256: "7286aec002c8feecc338cc33269e96b73955ab227456e9fb2a91f7fab8a358e9"
|
sha256: "3692a459204a33e04bc94f5fb91158faf4f2c8903281ddd82915adecdb1a901d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.2"
|
version: "2.3.0"
|
||||||
url_launcher_windows:
|
url_launcher_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1247,13 +1303,13 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.0"
|
||||||
web:
|
web:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: web
|
name: web
|
||||||
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
|
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.0"
|
version: "0.5.1"
|
||||||
web_socket_channel:
|
web_socket_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1320,5 +1376,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.2.3 <4.0.0"
|
dart: ">=3.3.0 <4.0.0"
|
||||||
flutter: ">=3.16.0"
|
flutter: ">=3.19.0"
|
||||||
|
@ -5,11 +5,12 @@ version: 0.3.0+3
|
|||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
flutter: ">=3.7.2"
|
flutter: ">=3.16.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
web: ^0.5.0
|
||||||
multi_split_view: ^2.4.0
|
multi_split_view: ^2.4.0
|
||||||
url_launcher: ^6.1.12
|
url_launcher: ^6.1.12
|
||||||
flutter_riverpod: ^2.3.7
|
flutter_riverpod: ^2.3.7
|
||||||
@ -41,7 +42,7 @@ dependencies:
|
|||||||
json_annotation: ^4.8.1
|
json_annotation: ^4.8.1
|
||||||
printing: ^5.11.1
|
printing: ^5.11.1
|
||||||
package_info_plus: ^4.1.0
|
package_info_plus: ^4.1.0
|
||||||
flutter_typeahead: ^4.8.0
|
flutter_typeahead: ^5.2.0
|
||||||
provider: ^6.0.5
|
provider: ^6.0.5
|
||||||
json_data_explorer:
|
json_data_explorer:
|
||||||
git:
|
git:
|
||||||
@ -54,6 +55,7 @@ dependencies:
|
|||||||
code_builder: ^4.9.0
|
code_builder: ^4.9.0
|
||||||
dart_style: ^2.3.4
|
dart_style: ^2.3.4
|
||||||
json_text_field: ^1.1.0
|
json_text_field: ^1.1.0
|
||||||
|
csv: ^5.1.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
@ -8,7 +8,7 @@ void main() {
|
|||||||
|
|
||||||
group('Test various Code generators', () {
|
group('Test various Code generators', () {
|
||||||
test('cURL', () {
|
test('cURL', () {
|
||||||
const expectedCode = r"""curl --url 'https://api.foss42.com'""";
|
const expectedCode = r"""curl --url 'https://api.apidash.dev'""";
|
||||||
expect(codeGen.getCode(CodegenLanguage.curl, requestModelGet1, "https"),
|
expect(codeGen.getCode(CodegenLanguage.curl, requestModelGet1, "https"),
|
||||||
expectedCode);
|
expectedCode);
|
||||||
});
|
});
|
||||||
@ -18,7 +18,7 @@ void main() {
|
|||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
try {
|
try {
|
||||||
final response = await dio.Dio.get('https://api.foss42.com');
|
final response = await dio.Dio.get('https://api.apidash.dev');
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
print(response.data);
|
print(response.data);
|
||||||
} on DioException catch (e, s) {
|
} on DioException catch (e, s) {
|
||||||
@ -40,7 +40,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com');
|
var uri = Uri.parse('https://api.apidash.dev');
|
||||||
|
|
||||||
final response = await http.get(uri);
|
final response = await http.get(uri);
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ void main() async {
|
|||||||
test('HAR', () {
|
test('HAR', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com",
|
"url": "https://api.apidash.dev",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": []
|
"headers": []
|
||||||
@ -73,7 +73,7 @@ void main() async {
|
|||||||
|
|
||||||
test('JS Axios', () {
|
test('JS Axios', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ axios(config)
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('JS Fetch', () {
|
test('JS Fetch', () {
|
||||||
const expectedCode = r"""let url = 'https://api.foss42.com';
|
const expectedCode = r"""let url = 'https://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -128,7 +128,7 @@ import okhttp3.Request
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com"
|
val url = "https://api.apidash.dev"
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
@ -151,7 +151,7 @@ fun main() {
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ axios(config)
|
|||||||
test('Nodejs Fetch', () {
|
test('Nodejs Fetch', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com';
|
let url = 'https://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -206,7 +206,7 @@ fetch(url, options)
|
|||||||
test('Python http.client', () {
|
test('Python http.client', () {
|
||||||
const expectedCode = r"""import http.client
|
const expectedCode = r"""import http.client
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "")
|
conn.request("GET", "")
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -223,7 +223,7 @@ print(data.decode("utf-8"))
|
|||||||
test('Python requests', () {
|
test('Python requests', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com'
|
url = 'https://api.apidash.dev'
|
||||||
|
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
|
||||||
|
@ -7,25 +7,25 @@ void main() {
|
|||||||
|
|
||||||
group('GET Request', () {
|
group('GET Request', () {
|
||||||
test('GET 1', () {
|
test('GET 1', () {
|
||||||
const expectedCode = r"""curl --url 'https://api.foss42.com'""";
|
const expectedCode = r"""curl --url 'https://api.apidash.dev'""";
|
||||||
expect(curlCodeGen.getCode(requestModelGet1, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelGet1, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('GET 2', () {
|
test('GET 2', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""curl --url 'https://api.foss42.com/country/data?code=US'""";
|
r"""curl --url 'https://api.apidash.dev/country/data?code=US'""";
|
||||||
expect(curlCodeGen.getCode(requestModelGet2, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelGet2, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('GET 3', () {
|
test('GET 3', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""curl --url 'https://api.foss42.com/country/data?code=IND'""";
|
r"""curl --url 'https://api.apidash.dev/country/data?code=IND'""";
|
||||||
expect(curlCodeGen.getCode(requestModelGet3, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelGet3, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('GET 4', () {
|
test('GET 4', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""curl --url 'https://api.foss42.com/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true'""";
|
r"""curl --url 'https://api.apidash.dev/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true'""";
|
||||||
expect(curlCodeGen.getCode(requestModelGet4, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelGet4, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('GET 7', () {
|
test('GET 7', () {
|
||||||
const expectedCode = r"""curl --url 'https://api.foss42.com'""";
|
const expectedCode = r"""curl --url 'https://api.apidash.dev'""";
|
||||||
expect(curlCodeGen.getCode(requestModelGet7, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelGet7, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -57,13 +57,13 @@ void main() {
|
|||||||
|
|
||||||
test('GET 9', () {
|
test('GET 9', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""curl --url 'https://api.foss42.com/humanize/social?num=8700000&add_space=true'""";
|
r"""curl --url 'https://api.apidash.dev/humanize/social?num=8700000&add_space=true'""";
|
||||||
expect(curlCodeGen.getCode(requestModelGet9, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelGet9, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('GET 10', () {
|
test('GET 10', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""curl --url 'https://api.foss42.com/humanize/social' \
|
r"""curl --url 'https://api.apidash.dev/humanize/social' \
|
||||||
--header 'User-Agent: Test Agent'""";
|
--header 'User-Agent: Test Agent'""";
|
||||||
expect(
|
expect(
|
||||||
curlCodeGen.getCode(
|
curlCodeGen.getCode(
|
||||||
@ -75,26 +75,26 @@ void main() {
|
|||||||
|
|
||||||
test('GET 11', () {
|
test('GET 11', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""curl --url 'https://api.foss42.com/humanize/social?num=8700000&digits=3' \
|
r"""curl --url 'https://api.apidash.dev/humanize/social?num=8700000&digits=3' \
|
||||||
--header 'User-Agent: Test Agent'""";
|
--header 'User-Agent: Test Agent'""";
|
||||||
expect(curlCodeGen.getCode(requestModelGet11, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelGet11, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('GET 12', () {
|
test('GET 12', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""curl --url 'https://api.foss42.com/humanize/social'""";
|
r"""curl --url 'https://api.apidash.dev/humanize/social'""";
|
||||||
expect(curlCodeGen.getCode(requestModelGet12, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelGet12, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
group('HEAD Request', () {
|
group('HEAD Request', () {
|
||||||
test('HEAD 1', () {
|
test('HEAD 1', () {
|
||||||
const expectedCode = r"""curl --head --url 'https://api.foss42.com'""";
|
const expectedCode = r"""curl --head --url 'https://api.apidash.dev'""";
|
||||||
expect(curlCodeGen.getCode(requestModelHead1, "https"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelHead1, "https"), expectedCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('HEAD 2', () {
|
test('HEAD 2', () {
|
||||||
const expectedCode = r"""curl --head --url 'http://api.foss42.com'""";
|
const expectedCode = r"""curl --head --url 'http://api.apidash.dev'""";
|
||||||
expect(curlCodeGen.getCode(requestModelHead2, "http"), expectedCode);
|
expect(curlCodeGen.getCode(requestModelHead2, "http"), expectedCode);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -102,7 +102,7 @@ void main() {
|
|||||||
group('POST Request', () {
|
group('POST Request', () {
|
||||||
test('POST 1', () {
|
test('POST 1', () {
|
||||||
const expectedCode = r"""curl --request POST \
|
const expectedCode = r"""curl --request POST \
|
||||||
--url 'https://api.foss42.com/case/lower' \
|
--url 'https://api.apidash.dev/case/lower' \
|
||||||
--header 'Content-Type: text/plain' \
|
--header 'Content-Type: text/plain' \
|
||||||
--data '{
|
--data '{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -112,7 +112,7 @@ void main() {
|
|||||||
|
|
||||||
test('POST 2', () {
|
test('POST 2', () {
|
||||||
const expectedCode = r"""curl --request POST \
|
const expectedCode = r"""curl --request POST \
|
||||||
--url 'https://api.foss42.com/case/lower' \
|
--url 'https://api.apidash.dev/case/lower' \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
--data '{
|
--data '{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -122,7 +122,7 @@ void main() {
|
|||||||
|
|
||||||
test('POST 3', () {
|
test('POST 3', () {
|
||||||
const expectedCode = r"""curl --request POST \
|
const expectedCode = r"""curl --request POST \
|
||||||
--url 'https://api.foss42.com/case/lower' \
|
--url 'https://api.apidash.dev/case/lower' \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
--header 'User-Agent: Test Agent' \
|
--header 'User-Agent: Test Agent' \
|
||||||
--data '{
|
--data '{
|
||||||
|
@ -12,7 +12,7 @@ void main() {
|
|||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
try {
|
try {
|
||||||
final response = await dio.Dio.get('https://api.foss42.com');
|
final response = await dio.Dio.get('https://api.apidash.dev');
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
print(response.data);
|
print(response.data);
|
||||||
} on DioException catch (e, s) {
|
} on DioException catch (e, s) {
|
||||||
@ -35,7 +35,7 @@ void main() async {
|
|||||||
try {
|
try {
|
||||||
final queryParams = {'code': 'US'};
|
final queryParams = {'code': 'US'};
|
||||||
final response = await dio.Dio.get(
|
final response = await dio.Dio.get(
|
||||||
'https://api.foss42.com/country/data',
|
'https://api.apidash.dev/country/data',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
@ -60,7 +60,7 @@ void main() async {
|
|||||||
try {
|
try {
|
||||||
final queryParams = {'code': 'IND'};
|
final queryParams = {'code': 'IND'};
|
||||||
final response = await dio.Dio.get(
|
final response = await dio.Dio.get(
|
||||||
'https://api.foss42.com/country/data?code=US',
|
'https://api.apidash.dev/country/data?code=US',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
@ -91,7 +91,7 @@ void main() async {
|
|||||||
'trailing_zeros': 'true',
|
'trailing_zeros': 'true',
|
||||||
};
|
};
|
||||||
final response = await dio.Dio.get(
|
final response = await dio.Dio.get(
|
||||||
'https://api.foss42.com/humanize/social',
|
'https://api.apidash.dev/humanize/social',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
@ -166,7 +166,7 @@ void main() async {
|
|||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
try {
|
try {
|
||||||
final response = await dio.Dio.get('https://api.foss42.com');
|
final response = await dio.Dio.get('https://api.apidash.dev');
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
print(response.data);
|
print(response.data);
|
||||||
} on DioException catch (e, s) {
|
} on DioException catch (e, s) {
|
||||||
@ -219,7 +219,7 @@ void main() async {
|
|||||||
'add_space': 'true',
|
'add_space': 'true',
|
||||||
};
|
};
|
||||||
final response = await dio.Dio.get(
|
final response = await dio.Dio.get(
|
||||||
'https://api.foss42.com/humanize/social',
|
'https://api.apidash.dev/humanize/social',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
@ -244,7 +244,7 @@ void main() async {
|
|||||||
try {
|
try {
|
||||||
final headers = {'User-Agent': 'Test Agent'};
|
final headers = {'User-Agent': 'Test Agent'};
|
||||||
final response = await dio.Dio.get(
|
final response = await dio.Dio.get(
|
||||||
'https://api.foss42.com/humanize/social',
|
'https://api.apidash.dev/humanize/social',
|
||||||
options: Options(headers: headers),
|
options: Options(headers: headers),
|
||||||
);
|
);
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
@ -278,7 +278,7 @@ void main() async {
|
|||||||
};
|
};
|
||||||
final headers = {'User-Agent': 'Test Agent'};
|
final headers = {'User-Agent': 'Test Agent'};
|
||||||
final response = await dio.Dio.get(
|
final response = await dio.Dio.get(
|
||||||
'https://api.foss42.com/humanize/social',
|
'https://api.apidash.dev/humanize/social',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
options: Options(headers: headers),
|
options: Options(headers: headers),
|
||||||
);
|
);
|
||||||
@ -302,7 +302,7 @@ void main() async {
|
|||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
try {
|
try {
|
||||||
final response = await dio.Dio.get('https://api.foss42.com/humanize/social');
|
final response = await dio.Dio.get('https://api.apidash.dev/humanize/social');
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
print(response.data);
|
print(response.data);
|
||||||
} on DioException catch (e, s) {
|
} on DioException catch (e, s) {
|
||||||
@ -325,7 +325,7 @@ void main() async {
|
|||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
try {
|
try {
|
||||||
final response = await dio.Dio.head('https://api.foss42.com');
|
final response = await dio.Dio.head('https://api.apidash.dev');
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
print(response.data);
|
print(response.data);
|
||||||
} on DioException catch (e, s) {
|
} on DioException catch (e, s) {
|
||||||
@ -346,7 +346,7 @@ void main() async {
|
|||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
try {
|
try {
|
||||||
final response = await dio.Dio.head('http://api.foss42.com');
|
final response = await dio.Dio.head('http://api.apidash.dev');
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
print(response.data);
|
print(response.data);
|
||||||
} on DioException catch (e, s) {
|
} on DioException catch (e, s) {
|
||||||
@ -373,7 +373,7 @@ void main() async {
|
|||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
}''';
|
}''';
|
||||||
final response = await dio.Dio.post(
|
final response = await dio.Dio.post(
|
||||||
'https://api.foss42.com/case/lower',
|
'https://api.apidash.dev/case/lower',
|
||||||
data: data,
|
data: data,
|
||||||
);
|
);
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
@ -401,7 +401,7 @@ void main() async {
|
|||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
}''');
|
}''');
|
||||||
final response = await dio.Dio.post(
|
final response = await dio.Dio.post(
|
||||||
'https://api.foss42.com/case/lower',
|
'https://api.apidash.dev/case/lower',
|
||||||
data: data,
|
data: data,
|
||||||
);
|
);
|
||||||
print(response.statusCode);
|
print(response.statusCode);
|
||||||
@ -430,7 +430,7 @@ void main() async {
|
|||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
}''');
|
}''');
|
||||||
final response = await dio.Dio.post(
|
final response = await dio.Dio.post(
|
||||||
'https://api.foss42.com/case/lower',
|
'https://api.apidash.dev/case/lower',
|
||||||
options: Options(headers: headers),
|
options: Options(headers: headers),
|
||||||
data: data,
|
data: data,
|
||||||
);
|
);
|
||||||
|
@ -11,7 +11,7 @@ void main() {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com');
|
var uri = Uri.parse('https://api.apidash.dev');
|
||||||
|
|
||||||
final response = await http.get(uri);
|
final response = await http.get(uri);
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/country/data');
|
var uri = Uri.parse('https://api.apidash.dev/country/data');
|
||||||
|
|
||||||
var queryParams = {'code': 'US'};
|
var queryParams = {'code': 'US'};
|
||||||
uri = uri.replace(queryParameters: queryParams);
|
uri = uri.replace(queryParameters: queryParams);
|
||||||
@ -57,7 +57,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/country/data?code=US');
|
var uri = Uri.parse('https://api.apidash.dev/country/data?code=US');
|
||||||
|
|
||||||
var queryParams = {'code': 'IND'};
|
var queryParams = {'code': 'IND'};
|
||||||
var urlQueryParams = Map<String, String>.from(uri.queryParameters);
|
var urlQueryParams = Map<String, String>.from(uri.queryParameters);
|
||||||
@ -83,7 +83,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/humanize/social');
|
var uri = Uri.parse('https://api.apidash.dev/humanize/social');
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
'num': '8700000',
|
'num': '8700000',
|
||||||
@ -168,7 +168,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com');
|
var uri = Uri.parse('https://api.apidash.dev');
|
||||||
|
|
||||||
final response = await http.get(uri);
|
final response = await http.get(uri);
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/humanize/social');
|
var uri = Uri.parse('https://api.apidash.dev/humanize/social');
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
'num': '8700000',
|
'num': '8700000',
|
||||||
@ -245,7 +245,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/humanize/social');
|
var uri = Uri.parse('https://api.apidash.dev/humanize/social');
|
||||||
|
|
||||||
var headers = {'User-Agent': 'Test Agent'};
|
var headers = {'User-Agent': 'Test Agent'};
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/humanize/social');
|
var uri = Uri.parse('https://api.apidash.dev/humanize/social');
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
'num': '8700000',
|
'num': '8700000',
|
||||||
@ -308,7 +308,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/humanize/social');
|
var uri = Uri.parse('https://api.apidash.dev/humanize/social');
|
||||||
|
|
||||||
final response = await http.get(uri);
|
final response = await http.get(uri);
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com');
|
var uri = Uri.parse('https://api.apidash.dev');
|
||||||
|
|
||||||
final response = await http.head(uri);
|
final response = await http.head(uri);
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('http://api.foss42.com');
|
var uri = Uri.parse('http://api.apidash.dev');
|
||||||
|
|
||||||
final response = await http.head(uri);
|
final response = await http.head(uri);
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/case/lower');
|
var uri = Uri.parse('https://api.apidash.dev/case/lower');
|
||||||
|
|
||||||
String body = r'''{
|
String body = r'''{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -406,7 +406,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/case/lower');
|
var uri = Uri.parse('https://api.apidash.dev/case/lower');
|
||||||
|
|
||||||
String body = r'''{
|
String body = r'''{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -437,7 +437,7 @@ void main() async {
|
|||||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/case/lower');
|
var uri = Uri.parse('https://api.apidash.dev/case/lower');
|
||||||
|
|
||||||
String body = r'''{
|
String body = r'''{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
|
@ -9,7 +9,7 @@ void main() {
|
|||||||
test('GET 1', () {
|
test('GET 1', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com",
|
"url": "https://api.apidash.dev",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": []
|
"headers": []
|
||||||
@ -20,7 +20,7 @@ void main() {
|
|||||||
test('GET 2', () {
|
test('GET 2', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com/country/data?code=US",
|
"url": "https://api.apidash.dev/country/data?code=US",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [
|
"queryString": [
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ void main() {
|
|||||||
test('GET 3', () {
|
test('GET 3', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com/country/data?code=IND",
|
"url": "https://api.apidash.dev/country/data?code=IND",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [
|
"queryString": [
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ void main() {
|
|||||||
test('GET 4', () {
|
test('GET 4', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true",
|
"url": "https://api.apidash.dev/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [
|
"queryString": [
|
||||||
{
|
{
|
||||||
@ -121,7 +121,7 @@ void main() {
|
|||||||
test('GET 7', () {
|
test('GET 7', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com",
|
"url": "https://api.apidash.dev",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": []
|
"headers": []
|
||||||
@ -153,7 +153,7 @@ void main() {
|
|||||||
test('GET 9', () {
|
test('GET 9', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com/humanize/social?num=8700000&add_space=true",
|
"url": "https://api.apidash.dev/humanize/social?num=8700000&add_space=true",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [
|
"queryString": [
|
||||||
{
|
{
|
||||||
@ -173,7 +173,7 @@ void main() {
|
|||||||
test('GET 10', () {
|
test('GET 10', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com/humanize/social",
|
"url": "https://api.apidash.dev/humanize/social",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": [
|
"headers": [
|
||||||
@ -194,7 +194,7 @@ void main() {
|
|||||||
test('GET 11', () {
|
test('GET 11', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com/humanize/social?num=8700000&digits=3",
|
"url": "https://api.apidash.dev/humanize/social?num=8700000&digits=3",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [
|
"queryString": [
|
||||||
{
|
{
|
||||||
@ -219,7 +219,7 @@ void main() {
|
|||||||
test('GET 12', () {
|
test('GET 12', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "https://api.foss42.com/humanize/social",
|
"url": "https://api.apidash.dev/humanize/social",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": []
|
"headers": []
|
||||||
@ -232,7 +232,7 @@ void main() {
|
|||||||
test('HEAD 1', () {
|
test('HEAD 1', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "HEAD",
|
"method": "HEAD",
|
||||||
"url": "https://api.foss42.com",
|
"url": "https://api.apidash.dev",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": []
|
"headers": []
|
||||||
@ -243,7 +243,7 @@ void main() {
|
|||||||
test('HEAD 2', () {
|
test('HEAD 2', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "HEAD",
|
"method": "HEAD",
|
||||||
"url": "http://api.foss42.com",
|
"url": "http://api.apidash.dev",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": []
|
"headers": []
|
||||||
@ -256,7 +256,7 @@ void main() {
|
|||||||
test('POST 1', () {
|
test('POST 1', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "https://api.foss42.com/case/lower",
|
"url": "https://api.apidash.dev/case/lower",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": [
|
"headers": [
|
||||||
@ -276,7 +276,7 @@ void main() {
|
|||||||
test('POST 2', () {
|
test('POST 2', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "https://api.foss42.com/case/lower",
|
"url": "https://api.apidash.dev/case/lower",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": [
|
"headers": [
|
||||||
@ -296,7 +296,7 @@ void main() {
|
|||||||
test('POST 3', () {
|
test('POST 3', () {
|
||||||
const expectedCode = r"""{
|
const expectedCode = r"""{
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "https://api.foss42.com/case/lower",
|
"url": "https://api.apidash.dev/case/lower",
|
||||||
"httpVersion": "HTTP/1.1",
|
"httpVersion": "HTTP/1.1",
|
||||||
"queryString": [],
|
"queryString": [],
|
||||||
"headers": [
|
"headers": [
|
||||||
|
@ -8,7 +8,7 @@ void main() {
|
|||||||
group('GET Request', () {
|
group('GET Request', () {
|
||||||
test('GET 1', () {
|
test('GET 1', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ axios(config)
|
|||||||
|
|
||||||
test('GET 2', () {
|
test('GET 2', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/country/data',
|
url: 'https://api.apidash.dev/country/data',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"code": "US"
|
"code": "US"
|
||||||
@ -53,7 +53,7 @@ axios(config)
|
|||||||
|
|
||||||
test('GET 3', () {
|
test('GET 3', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/country/data',
|
url: 'https://api.apidash.dev/country/data',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"code": "IND"
|
"code": "IND"
|
||||||
@ -77,7 +77,7 @@ axios(config)
|
|||||||
|
|
||||||
test('GET 4', () {
|
test('GET 4', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -156,7 +156,7 @@ axios(config)
|
|||||||
|
|
||||||
test('GET 7', () {
|
test('GET 7', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ axios(config)
|
|||||||
|
|
||||||
test('GET 9', () {
|
test('GET 9', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -229,7 +229,7 @@ axios(config)
|
|||||||
|
|
||||||
test('GET 10', () {
|
test('GET 10', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": "Test Agent"
|
"User-Agent": "Test Agent"
|
||||||
@ -258,7 +258,7 @@ axios(config)
|
|||||||
|
|
||||||
test('GET 11', () {
|
test('GET 11', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -286,7 +286,7 @@ axios(config)
|
|||||||
|
|
||||||
test('GET 12', () {
|
test('GET 12', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ axios(config)
|
|||||||
group('HEAD Request', () {
|
group('HEAD Request', () {
|
||||||
test('HEAD 1', () {
|
test('HEAD 1', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: 'head'
|
method: 'head'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ axios(config)
|
|||||||
|
|
||||||
test('HEAD 2', () {
|
test('HEAD 2', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'http://api.foss42.com',
|
url: 'http://api.apidash.dev',
|
||||||
method: 'head'
|
method: 'head'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ axios(config)
|
|||||||
group('POST Request', () {
|
group('POST Request', () {
|
||||||
test('POST 1', () {
|
test('POST 1', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
@ -378,7 +378,7 @@ axios(config)
|
|||||||
|
|
||||||
test('POST 2', () {
|
test('POST 2', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@ -403,7 +403,7 @@ axios(config)
|
|||||||
|
|
||||||
test('POST 3', () {
|
test('POST 3', () {
|
||||||
const expectedCode = r"""let config = {
|
const expectedCode = r"""let config = {
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -7,7 +7,7 @@ void main() {
|
|||||||
|
|
||||||
group('GET Request', () {
|
group('GET Request', () {
|
||||||
test('GET 1', () {
|
test('GET 1', () {
|
||||||
const expectedCode = r"""let url = 'https://api.foss42.com';
|
const expectedCode = r"""let url = 'https://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -33,7 +33,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
test('GET 2', () {
|
test('GET 2', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""let url = 'https://api.foss42.com/country/data?code=US';
|
r"""let url = 'https://api.apidash.dev/country/data?code=US';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -59,7 +59,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
test('GET 3', () {
|
test('GET 3', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""let url = 'https://api.foss42.com/country/data?code=IND';
|
r"""let url = 'https://api.apidash.dev/country/data?code=IND';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -85,7 +85,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
test('GET 4', () {
|
test('GET 4', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""let url = 'https://api.foss42.com/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true';
|
r"""let url = 'https://api.apidash.dev/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -168,7 +168,7 @@ fetch(url, options)
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('GET 7', () {
|
test('GET 7', () {
|
||||||
const expectedCode = r"""let url = 'https://api.foss42.com';
|
const expectedCode = r"""let url = 'https://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -223,7 +223,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
test('GET 9', () {
|
test('GET 9', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""let url = 'https://api.foss42.com/humanize/social?num=8700000&add_space=true';
|
r"""let url = 'https://api.apidash.dev/humanize/social?num=8700000&add_space=true';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -249,7 +249,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
test('GET 10', () {
|
test('GET 10', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""let url = 'https://api.foss42.com/humanize/social';
|
r"""let url = 'https://api.apidash.dev/humanize/social';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -283,7 +283,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
test('GET 11', () {
|
test('GET 11', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""let url = 'https://api.foss42.com/humanize/social?num=8700000&digits=3';
|
r"""let url = 'https://api.apidash.dev/humanize/social?num=8700000&digits=3';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -312,7 +312,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
test('GET 12', () {
|
test('GET 12', () {
|
||||||
const expectedCode =
|
const expectedCode =
|
||||||
r"""let url = 'https://api.foss42.com/humanize/social';
|
r"""let url = 'https://api.apidash.dev/humanize/social';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -339,7 +339,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
group('HEAD Request', () {
|
group('HEAD Request', () {
|
||||||
test('HEAD 1', () {
|
test('HEAD 1', () {
|
||||||
const expectedCode = r"""let url = 'https://api.foss42.com';
|
const expectedCode = r"""let url = 'https://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'HEAD'
|
method: 'HEAD'
|
||||||
@ -364,7 +364,7 @@ fetch(url, options)
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('HEAD 2', () {
|
test('HEAD 2', () {
|
||||||
const expectedCode = r"""let url = 'http://api.foss42.com';
|
const expectedCode = r"""let url = 'http://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'HEAD'
|
method: 'HEAD'
|
||||||
@ -391,7 +391,7 @@ fetch(url, options)
|
|||||||
|
|
||||||
group('POST Request', () {
|
group('POST Request', () {
|
||||||
test('POST 1', () {
|
test('POST 1', () {
|
||||||
const expectedCode = r"""let url = 'https://api.foss42.com/case/lower';
|
const expectedCode = r"""let url = 'https://api.apidash.dev/case/lower';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -421,7 +421,7 @@ fetch(url, options)
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('POST 2', () {
|
test('POST 2', () {
|
||||||
const expectedCode = r"""let url = 'https://api.foss42.com/case/lower';
|
const expectedCode = r"""let url = 'https://api.apidash.dev/case/lower';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -451,7 +451,7 @@ fetch(url, options)
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('POST 3', () {
|
test('POST 3', () {
|
||||||
const expectedCode = r"""let url = 'https://api.foss42.com/case/lower';
|
const expectedCode = r"""let url = 'https://api.apidash.dev/case/lower';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -13,7 +13,7 @@ import okhttp3.Request
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com"
|
val url = "https://api.apidash.dev"
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
@ -38,7 +38,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/country/data".toHttpUrl().newBuilder()
|
val url = "https://api.apidash.dev/country/data".toHttpUrl().newBuilder()
|
||||||
.addQueryParameter("code", "US")
|
.addQueryParameter("code", "US")
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/country/data".toHttpUrl().newBuilder()
|
val url = "https://api.apidash.dev/country/data".toHttpUrl().newBuilder()
|
||||||
.addQueryParameter("code", "IND")
|
.addQueryParameter("code", "IND")
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/humanize/social".toHttpUrl().newBuilder()
|
val url = "https://api.apidash.dev/humanize/social".toHttpUrl().newBuilder()
|
||||||
.addQueryParameter("num", "8700000")
|
.addQueryParameter("num", "8700000")
|
||||||
.addQueryParameter("digits", "3")
|
.addQueryParameter("digits", "3")
|
||||||
.addQueryParameter("system", "SS")
|
.addQueryParameter("system", "SS")
|
||||||
@ -175,7 +175,7 @@ import okhttp3.Request
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com"
|
val url = "https://api.apidash.dev"
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
@ -228,7 +228,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/humanize/social".toHttpUrl().newBuilder()
|
val url = "https://api.apidash.dev/humanize/social".toHttpUrl().newBuilder()
|
||||||
.addQueryParameter("num", "8700000")
|
.addQueryParameter("num", "8700000")
|
||||||
.addQueryParameter("add_space", "true")
|
.addQueryParameter("add_space", "true")
|
||||||
.build()
|
.build()
|
||||||
@ -255,7 +255,7 @@ import okhttp3.Request
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/humanize/social"
|
val url = "https://api.apidash.dev/humanize/social"
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
@ -285,7 +285,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/humanize/social".toHttpUrl().newBuilder()
|
val url = "https://api.apidash.dev/humanize/social".toHttpUrl().newBuilder()
|
||||||
.addQueryParameter("num", "8700000")
|
.addQueryParameter("num", "8700000")
|
||||||
.addQueryParameter("digits", "3")
|
.addQueryParameter("digits", "3")
|
||||||
.build()
|
.build()
|
||||||
@ -313,7 +313,7 @@ import okhttp3.Request
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/humanize/social"
|
val url = "https://api.apidash.dev/humanize/social"
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
@ -339,7 +339,7 @@ import okhttp3.Request
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com"
|
val url = "https://api.apidash.dev"
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
@ -363,7 +363,7 @@ import okhttp3.Request
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "http://api.foss42.com"
|
val url = "http://api.apidash.dev"
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
@ -391,7 +391,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/case/lower"
|
val url = "https://api.apidash.dev/case/lower"
|
||||||
|
|
||||||
val mediaType = "text/plain".toMediaType()
|
val mediaType = "text/plain".toMediaType()
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/case/lower"
|
val url = "https://api.apidash.dev/case/lower"
|
||||||
|
|
||||||
val mediaType = "application/json".toMediaType()
|
val mediaType = "application/json".toMediaType()
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
fun main() {
|
fun main() {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
val url = "https://api.foss42.com/case/lower"
|
val url = "https://api.apidash.dev/case/lower"
|
||||||
|
|
||||||
val mediaType = "application/json".toMediaType()
|
val mediaType = "application/json".toMediaType()
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ void main() {
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/country/data',
|
url: 'https://api.apidash.dev/country/data',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"code": "US"
|
"code": "US"
|
||||||
@ -59,7 +59,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/country/data',
|
url: 'https://api.apidash.dev/country/data',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"code": "IND"
|
"code": "IND"
|
||||||
@ -85,7 +85,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -170,7 +170,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -249,7 +249,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": "Test Agent"
|
"User-Agent": "Test Agent"
|
||||||
@ -280,7 +280,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -310,7 +310,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: 'head'
|
method: 'head'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'http://api.foss42.com',
|
url: 'http://api.apidash.dev',
|
||||||
method: 'head'
|
method: 'head'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
@ -410,7 +410,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@ -437,7 +437,7 @@ axios(config)
|
|||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -9,7 +9,7 @@ void main() {
|
|||||||
test('GET 1', () {
|
test('GET 1', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com';
|
let url = 'https://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -36,7 +36,7 @@ fetch(url, options)
|
|||||||
test('GET 2', () {
|
test('GET 2', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/country/data?code=US';
|
let url = 'https://api.apidash.dev/country/data?code=US';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -63,7 +63,7 @@ fetch(url, options)
|
|||||||
test('GET 3', () {
|
test('GET 3', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/country/data?code=IND';
|
let url = 'https://api.apidash.dev/country/data?code=IND';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -90,7 +90,7 @@ fetch(url, options)
|
|||||||
test('GET 4', () {
|
test('GET 4', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true';
|
let url = 'https://api.apidash.dev/humanize/social?num=8700000&digits=3&system=SS&add_space=true&trailing_zeros=true';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -177,7 +177,7 @@ fetch(url, options)
|
|||||||
test('GET 7', () {
|
test('GET 7', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com';
|
let url = 'https://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -234,7 +234,7 @@ fetch(url, options)
|
|||||||
test('GET 9', () {
|
test('GET 9', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/humanize/social?num=8700000&add_space=true';
|
let url = 'https://api.apidash.dev/humanize/social?num=8700000&add_space=true';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -261,7 +261,7 @@ fetch(url, options)
|
|||||||
test('GET 10', () {
|
test('GET 10', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/humanize/social';
|
let url = 'https://api.apidash.dev/humanize/social';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -296,7 +296,7 @@ fetch(url, options)
|
|||||||
test('GET 11', () {
|
test('GET 11', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/humanize/social?num=8700000&digits=3';
|
let url = 'https://api.apidash.dev/humanize/social?num=8700000&digits=3';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -326,7 +326,7 @@ fetch(url, options)
|
|||||||
test('GET 12', () {
|
test('GET 12', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/humanize/social';
|
let url = 'https://api.apidash.dev/humanize/social';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@ -355,7 +355,7 @@ fetch(url, options)
|
|||||||
test('HEAD 1', () {
|
test('HEAD 1', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com';
|
let url = 'https://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'HEAD'
|
method: 'HEAD'
|
||||||
@ -382,7 +382,7 @@ fetch(url, options)
|
|||||||
test('HEAD 2', () {
|
test('HEAD 2', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'http://api.foss42.com';
|
let url = 'http://api.apidash.dev';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'HEAD'
|
method: 'HEAD'
|
||||||
@ -411,7 +411,7 @@ fetch(url, options)
|
|||||||
test('POST 1', () {
|
test('POST 1', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/case/lower';
|
let url = 'https://api.apidash.dev/case/lower';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -443,7 +443,7 @@ fetch(url, options)
|
|||||||
test('POST 2', () {
|
test('POST 2', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/case/lower';
|
let url = 'https://api.apidash.dev/case/lower';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -475,7 +475,7 @@ fetch(url, options)
|
|||||||
test('POST 3', () {
|
test('POST 3', () {
|
||||||
const expectedCode = r"""import fetch from 'node-fetch';
|
const expectedCode = r"""import fetch from 'node-fetch';
|
||||||
|
|
||||||
let url = 'https://api.foss42.com/case/lower';
|
let url = 'https://api.apidash.dev/case/lower';
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -9,7 +9,7 @@ void main() {
|
|||||||
test('GET 1', () {
|
test('GET 1', () {
|
||||||
const expectedCode = r"""import http.client
|
const expectedCode = r"""import http.client
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "")
|
conn.request("GET", "")
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -30,7 +30,7 @@ queryParams = {
|
|||||||
}
|
}
|
||||||
queryParamsStr = '?' + urlencode(queryParams)
|
queryParamsStr = '?' + urlencode(queryParams)
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "/country/data" + queryParamsStr)
|
conn.request("GET", "/country/data" + queryParamsStr)
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -51,7 +51,7 @@ queryParams = {
|
|||||||
}
|
}
|
||||||
queryParamsStr = '?' + urlencode(queryParams)
|
queryParamsStr = '?' + urlencode(queryParams)
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "/country/data" + queryParamsStr)
|
conn.request("GET", "/country/data" + queryParamsStr)
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -76,7 +76,7 @@ queryParams = {
|
|||||||
}
|
}
|
||||||
queryParamsStr = '?' + urlencode(queryParams)
|
queryParamsStr = '?' + urlencode(queryParams)
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "/humanize/social" + queryParamsStr)
|
conn.request("GET", "/humanize/social" + queryParamsStr)
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -137,7 +137,7 @@ print(data.decode("utf-8"))
|
|||||||
test('GET 7', () {
|
test('GET 7', () {
|
||||||
const expectedCode = r"""import http.client
|
const expectedCode = r"""import http.client
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "")
|
conn.request("GET", "")
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -185,7 +185,7 @@ queryParams = {
|
|||||||
}
|
}
|
||||||
queryParamsStr = '?' + urlencode(queryParams)
|
queryParamsStr = '?' + urlencode(queryParams)
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "/humanize/social" + queryParamsStr)
|
conn.request("GET", "/humanize/social" + queryParamsStr)
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -204,7 +204,7 @@ headers = {
|
|||||||
"User-Agent": "Test Agent"
|
"User-Agent": "Test Agent"
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "/humanize/social",
|
conn.request("GET", "/humanize/social",
|
||||||
headers= headers)
|
headers= headers)
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ headers = {
|
|||||||
"User-Agent": "Test Agent"
|
"User-Agent": "Test Agent"
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "/humanize/social" + queryParamsStr,
|
conn.request("GET", "/humanize/social" + queryParamsStr,
|
||||||
headers= headers)
|
headers= headers)
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ print(data.decode("utf-8"))
|
|||||||
test('GET 12', () {
|
test('GET 12', () {
|
||||||
const expectedCode = r"""import http.client
|
const expectedCode = r"""import http.client
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("GET", "/humanize/social")
|
conn.request("GET", "/humanize/social")
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -268,7 +268,7 @@ print(data.decode("utf-8"))
|
|||||||
test('HEAD 1', () {
|
test('HEAD 1', () {
|
||||||
const expectedCode = r"""import http.client
|
const expectedCode = r"""import http.client
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("HEAD", "")
|
conn.request("HEAD", "")
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -283,7 +283,7 @@ print(data.decode("utf-8"))
|
|||||||
test('HEAD 2', () {
|
test('HEAD 2', () {
|
||||||
const expectedCode = r"""import http.client
|
const expectedCode = r"""import http.client
|
||||||
|
|
||||||
conn = http.client.HTTPConnection("api.foss42.com")
|
conn = http.client.HTTPConnection("api.apidash.dev")
|
||||||
conn.request("HEAD", "")
|
conn.request("HEAD", "")
|
||||||
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
@ -308,7 +308,7 @@ headers = {
|
|||||||
"content-type": "text/plain"
|
"content-type": "text/plain"
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("POST", "/case/lower",
|
conn.request("POST", "/case/lower",
|
||||||
body= body,
|
body= body,
|
||||||
headers= headers)
|
headers= headers)
|
||||||
@ -333,7 +333,7 @@ headers = {
|
|||||||
"content-type": "application/json"
|
"content-type": "application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("POST", "/case/lower",
|
conn.request("POST", "/case/lower",
|
||||||
body= body,
|
body= body,
|
||||||
headers= headers)
|
headers= headers)
|
||||||
@ -359,7 +359,7 @@ headers = {
|
|||||||
"content-type": "application/json"
|
"content-type": "application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||||
conn.request("POST", "/case/lower",
|
conn.request("POST", "/case/lower",
|
||||||
body= body,
|
body= body,
|
||||||
headers= headers)
|
headers= headers)
|
||||||
|
@ -9,7 +9,7 @@ void main() {
|
|||||||
test('GET 1', () {
|
test('GET 1', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com'
|
url = 'https://api.apidash.dev'
|
||||||
|
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ print('Response Body:', response.text)
|
|||||||
test('GET 2', () {
|
test('GET 2', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/country/data'
|
url = 'https://api.apidash.dev/country/data'
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"code": "US"
|
"code": "US"
|
||||||
@ -41,7 +41,7 @@ print('Response Body:', response.text)
|
|||||||
test('GET 3', () {
|
test('GET 3', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/country/data'
|
url = 'https://api.apidash.dev/country/data'
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"code": "IND"
|
"code": "IND"
|
||||||
@ -59,7 +59,7 @@ print('Response Body:', response.text)
|
|||||||
test('GET 4', () {
|
test('GET 4', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/humanize/social'
|
url = 'https://api.apidash.dev/humanize/social'
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -121,7 +121,7 @@ print('Response Body:', response.text)
|
|||||||
test('GET 7', () {
|
test('GET 7', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com'
|
url = 'https://api.apidash.dev'
|
||||||
|
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ print('Response Body:', response.text)
|
|||||||
test('GET 9', () {
|
test('GET 9', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/humanize/social'
|
url = 'https://api.apidash.dev/humanize/social'
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -176,7 +176,7 @@ print('Response Body:', response.text)
|
|||||||
test('GET 10', () {
|
test('GET 10', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/humanize/social'
|
url = 'https://api.apidash.dev/humanize/social'
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent": "Test Agent"
|
"User-Agent": "Test Agent"
|
||||||
@ -198,7 +198,7 @@ print('Response Body:', response.text)
|
|||||||
test('GET 11', () {
|
test('GET 11', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/humanize/social'
|
url = 'https://api.apidash.dev/humanize/social'
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"num": "8700000",
|
"num": "8700000",
|
||||||
@ -221,7 +221,7 @@ print('Response Body:', response.text)
|
|||||||
test('GET 12', () {
|
test('GET 12', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/humanize/social'
|
url = 'https://api.apidash.dev/humanize/social'
|
||||||
|
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ print('Response Body:', response.text)
|
|||||||
test('HEAD 1', () {
|
test('HEAD 1', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com'
|
url = 'https://api.apidash.dev'
|
||||||
|
|
||||||
response = requests.head(url)
|
response = requests.head(url)
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ print('Response Body:', response.text)
|
|||||||
test('HEAD 2', () {
|
test('HEAD 2', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'http://api.foss42.com'
|
url = 'http://api.apidash.dev'
|
||||||
|
|
||||||
response = requests.head(url)
|
response = requests.head(url)
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ print('Response Body:', response.text)
|
|||||||
test('POST 1', () {
|
test('POST 1', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/case/lower'
|
url = 'https://api.apidash.dev/case/lower'
|
||||||
|
|
||||||
payload = r'''{
|
payload = r'''{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -289,7 +289,7 @@ print('Response Body:', response.text)
|
|||||||
test('POST 2', () {
|
test('POST 2', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/case/lower'
|
url = 'https://api.apidash.dev/case/lower'
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -307,7 +307,7 @@ print('Response Body:', response.text)
|
|||||||
test('POST 3', () {
|
test('POST 3', () {
|
||||||
const expectedCode = r"""import requests
|
const expectedCode = r"""import requests
|
||||||
|
|
||||||
url = 'https://api.foss42.com/case/lower'
|
url = 'https://api.apidash.dev/case/lower'
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
|
@ -52,7 +52,7 @@ void main() {
|
|||||||
RequestModel requestModel = RequestModel(
|
RequestModel requestModel = RequestModel(
|
||||||
id: '1',
|
id: '1',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
url: 'api.foss42.com/case/lower',
|
url: 'api.apidash.dev/case/lower',
|
||||||
name: 'foss42 api',
|
name: 'foss42 api',
|
||||||
requestHeaders: const [
|
requestHeaders: const [
|
||||||
NameValueModel(name: 'content-length', value: '18'),
|
NameValueModel(name: 'content-length', value: '18'),
|
||||||
@ -69,7 +69,7 @@ void main() {
|
|||||||
RequestModel requestModelDup = const RequestModel(
|
RequestModel requestModelDup = const RequestModel(
|
||||||
id: '1',
|
id: '1',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
url: 'api.foss42.com/case/lower',
|
url: 'api.apidash.dev/case/lower',
|
||||||
name: 'foss42 api',
|
name: 'foss42 api',
|
||||||
requestHeaders: [
|
requestHeaders: [
|
||||||
NameValueModel(name: 'content-length', value: '18'),
|
NameValueModel(name: 'content-length', value: '18'),
|
||||||
@ -84,7 +84,7 @@ void main() {
|
|||||||
RequestModel requestModelCopy = const RequestModel(
|
RequestModel requestModelCopy = const RequestModel(
|
||||||
id: '1',
|
id: '1',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
url: 'api.foss42.com/case/lower',
|
url: 'api.apidash.dev/case/lower',
|
||||||
name: 'foss42 api (copy)',
|
name: 'foss42 api (copy)',
|
||||||
requestHeaders: [
|
requestHeaders: [
|
||||||
NameValueModel(name: 'content-length', value: '18'),
|
NameValueModel(name: 'content-length', value: '18'),
|
||||||
@ -99,7 +99,7 @@ void main() {
|
|||||||
Map<String, dynamic> requestModelAsJson = {
|
Map<String, dynamic> requestModelAsJson = {
|
||||||
"id": '1',
|
"id": '1',
|
||||||
"method": 'post',
|
"method": 'post',
|
||||||
"url": 'api.foss42.com/case/lower',
|
"url": 'api.apidash.dev/case/lower',
|
||||||
"name": 'foss42 api',
|
"name": 'foss42 api',
|
||||||
'description': '',
|
'description': '',
|
||||||
"requestHeaders": {
|
"requestHeaders": {
|
||||||
@ -138,7 +138,7 @@ void main() {
|
|||||||
final requestModeDupString = [
|
final requestModeDupString = [
|
||||||
"Request Id: 1",
|
"Request Id: 1",
|
||||||
"Request Method: post",
|
"Request Method: post",
|
||||||
"Request URL: api.foss42.com/case/lower",
|
"Request URL: api.apidash.dev/case/lower",
|
||||||
"Request Name: foss42 api",
|
"Request Name: foss42 api",
|
||||||
"Request Description: ",
|
"Request Description: ",
|
||||||
"Request Tab Index: 0",
|
"Request Tab Index: 0",
|
||||||
|
@ -81,19 +81,19 @@ void main() {
|
|||||||
|
|
||||||
test('Testing fromResponse', () async {
|
test('Testing fromResponse', () async {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse('https://api.foss42.com/'),
|
Uri.parse('https://api.apidash.dev/'),
|
||||||
);
|
);
|
||||||
final responseData = responseModel.fromResponse(response: response);
|
final responseData = responseModel.fromResponse(response: response);
|
||||||
expect(responseData.statusCode, 200);
|
expect(responseData.statusCode, 200);
|
||||||
expect(responseData.body,
|
expect(responseData.body,
|
||||||
'{"message":"Check out https://foss42.com for API docs to get started."}');
|
'{"data":"Check out https://api.apidash.dev/docs to get started."}');
|
||||||
expect(responseData.formattedBody, '''{
|
expect(responseData.formattedBody, '''{
|
||||||
"message": "Check out https://foss42.com for API docs to get started."
|
"data": "Check out https://api.apidash.dev/docs to get started."
|
||||||
}''');
|
}''');
|
||||||
});
|
});
|
||||||
test('Testing fromResponse for contentType not Json', () async {
|
test('Testing fromResponse for contentType not Json', () async {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse('https://foss42.com/'),
|
Uri.parse('https://apidash.dev/'),
|
||||||
);
|
);
|
||||||
final responseData = responseModel.fromResponse(response: response);
|
final responseData = responseModel.fromResponse(response: response);
|
||||||
expect(responseData.statusCode, 200);
|
expect(responseData.statusCode, 200);
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
import 'package:apidash/models/models.dart' show NameValueModel, RequestModel, FormDataModel;
|
import 'package:apidash/models/models.dart'
|
||||||
|
show FormDataModel, NameValueModel, RequestModel;
|
||||||
import 'package:apidash/consts.dart';
|
import 'package:apidash/consts.dart';
|
||||||
|
|
||||||
/// Basic GET request model
|
/// Basic GET request model
|
||||||
const requestModelGet1 = RequestModel(
|
const requestModelGet1 = RequestModel(
|
||||||
id: 'get1',
|
id: 'get1',
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// GET request model with query params
|
/// GET request model with query params
|
||||||
const requestModelGet2 = RequestModel(
|
const requestModelGet2 = RequestModel(
|
||||||
id: 'get2',
|
id: 'get2',
|
||||||
url: 'https://api.foss42.com/country/data',
|
url: 'https://api.apidash.dev/country/data',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
requestParams: [
|
requestParams: [
|
||||||
NameValueModel(name: 'code', value: 'US'),
|
NameValueModel(name: 'code', value: 'US'),
|
||||||
@ -21,7 +22,7 @@ const requestModelGet2 = RequestModel(
|
|||||||
/// GET request model with override query params
|
/// GET request model with override query params
|
||||||
const requestModelGet3 = RequestModel(
|
const requestModelGet3 = RequestModel(
|
||||||
id: 'get3',
|
id: 'get3',
|
||||||
url: 'https://api.foss42.com/country/data?code=US',
|
url: 'https://api.apidash.dev/country/data?code=US',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
requestParams: [
|
requestParams: [
|
||||||
NameValueModel(name: 'code', value: 'IND'),
|
NameValueModel(name: 'code', value: 'IND'),
|
||||||
@ -31,7 +32,7 @@ const requestModelGet3 = RequestModel(
|
|||||||
/// GET request model with different types of query params
|
/// GET request model with different types of query params
|
||||||
const requestModelGet4 = RequestModel(
|
const requestModelGet4 = RequestModel(
|
||||||
id: 'get4',
|
id: 'get4',
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
requestParams: [
|
requestParams: [
|
||||||
NameValueModel(name: 'num', value: '8700000'),
|
NameValueModel(name: 'num', value: '8700000'),
|
||||||
@ -68,7 +69,7 @@ const requestModelGet6 = RequestModel(
|
|||||||
/// GET request model with body
|
/// GET request model with body
|
||||||
const requestModelGet7 = RequestModel(
|
const requestModelGet7 = RequestModel(
|
||||||
id: 'get7',
|
id: 'get7',
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
requestBodyContentType: ContentType.text,
|
requestBodyContentType: ContentType.text,
|
||||||
requestBody:
|
requestBody:
|
||||||
@ -93,7 +94,7 @@ const requestModelGet8 = RequestModel(
|
|||||||
/// GET request model with some params enabled
|
/// GET request model with some params enabled
|
||||||
const requestModelGet9 = RequestModel(
|
const requestModelGet9 = RequestModel(
|
||||||
id: 'get9',
|
id: 'get9',
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
requestParams: [
|
requestParams: [
|
||||||
NameValueModel(name: 'num', value: '8700000'),
|
NameValueModel(name: 'num', value: '8700000'),
|
||||||
@ -112,7 +113,7 @@ const requestModelGet9 = RequestModel(
|
|||||||
/// GET Request model with some headers enabled
|
/// GET Request model with some headers enabled
|
||||||
const requestModelGet10 = RequestModel(
|
const requestModelGet10 = RequestModel(
|
||||||
id: 'get10',
|
id: 'get10',
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
requestHeaders: [
|
requestHeaders: [
|
||||||
NameValueModel(name: 'User-Agent', value: 'Test Agent'),
|
NameValueModel(name: 'User-Agent', value: 'Test Agent'),
|
||||||
@ -127,7 +128,7 @@ const requestModelGet10 = RequestModel(
|
|||||||
/// GET Request model with some headers & URL parameters enabled
|
/// GET Request model with some headers & URL parameters enabled
|
||||||
const requestModelGet11 = RequestModel(
|
const requestModelGet11 = RequestModel(
|
||||||
id: 'get11',
|
id: 'get11',
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
requestParams: [
|
requestParams: [
|
||||||
NameValueModel(name: 'num', value: '8700000'),
|
NameValueModel(name: 'num', value: '8700000'),
|
||||||
@ -154,7 +155,7 @@ const requestModelGet11 = RequestModel(
|
|||||||
/// Request model with all headers & URL parameters disabled
|
/// Request model with all headers & URL parameters disabled
|
||||||
const requestModelGet12 = RequestModel(
|
const requestModelGet12 = RequestModel(
|
||||||
id: 'get12',
|
id: 'get12',
|
||||||
url: 'https://api.foss42.com/humanize/social',
|
url: 'https://api.apidash.dev/humanize/social',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
requestParams: [
|
requestParams: [
|
||||||
NameValueModel(name: 'num', value: '8700000'),
|
NameValueModel(name: 'num', value: '8700000'),
|
||||||
@ -181,21 +182,21 @@ const requestModelGet12 = RequestModel(
|
|||||||
/// Basic HEAD request model
|
/// Basic HEAD request model
|
||||||
const requestModelHead1 = RequestModel(
|
const requestModelHead1 = RequestModel(
|
||||||
id: 'head1',
|
id: 'head1',
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: HTTPVerb.head,
|
method: HTTPVerb.head,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Without URI Scheme (pass default as http)
|
/// Without URI Scheme (pass default as http)
|
||||||
const requestModelHead2 = RequestModel(
|
const requestModelHead2 = RequestModel(
|
||||||
id: 'head2',
|
id: 'head2',
|
||||||
url: 'api.foss42.com',
|
url: 'api.apidash.dev',
|
||||||
method: HTTPVerb.head,
|
method: HTTPVerb.head,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Basic POST request model (txt body)
|
/// Basic POST request model (txt body)
|
||||||
const requestModelPost1 = RequestModel(
|
const requestModelPost1 = RequestModel(
|
||||||
id: 'post1',
|
id: 'post1',
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
requestBody: r"""{
|
requestBody: r"""{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -205,7 +206,7 @@ const requestModelPost1 = RequestModel(
|
|||||||
/// POST request model with JSON body
|
/// POST request model with JSON body
|
||||||
const requestModelPost2 = RequestModel(
|
const requestModelPost2 = RequestModel(
|
||||||
id: 'post2',
|
id: 'post2',
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
requestBody: r"""{
|
requestBody: r"""{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -215,7 +216,7 @@ const requestModelPost2 = RequestModel(
|
|||||||
/// POST request model with headers
|
/// POST request model with headers
|
||||||
const requestModelPost3 = RequestModel(
|
const requestModelPost3 = RequestModel(
|
||||||
id: 'post3',
|
id: 'post3',
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/case/lower',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
requestBody: r"""{
|
requestBody: r"""{
|
||||||
"text": "I LOVE Flutter"
|
"text": "I LOVE Flutter"
|
||||||
@ -226,16 +227,103 @@ const requestModelPost3 = RequestModel(
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
/// POST request model with FormData
|
/// POST request model with multipart body(text)
|
||||||
const requestModelPost4 = RequestModel(
|
const requestModelPost4 = RequestModel(
|
||||||
id: 'post3',
|
id: 'post4',
|
||||||
url: 'https://api.foss42.com/case/lower',
|
url: 'https://api.apidash.dev/io/form',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
requestFormDataList: [FormDataModel(name: "text", value: "I LOVE Flutter", type: FormDataType.text)],
|
requestFormDataList: [
|
||||||
|
FormDataModel(name: "text", value: "API", type: FormDataType.text),
|
||||||
|
FormDataModel(name: "sep", value: "|", type: FormDataType.text),
|
||||||
|
FormDataModel(name: "times", value: "3", type: FormDataType.text),
|
||||||
|
],
|
||||||
requestBodyContentType: ContentType.formdata,
|
requestBodyContentType: ContentType.formdata,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// POST request model with multipart body and headers
|
||||||
|
const requestModelPost5 = RequestModel(
|
||||||
|
id: 'post5',
|
||||||
|
url: 'https://api.apidash.dev/io/form',
|
||||||
|
method: HTTPVerb.post,
|
||||||
|
requestFormDataList: [
|
||||||
|
FormDataModel(name: "text", value: "API", type: FormDataType.text),
|
||||||
|
FormDataModel(name: "sep", value: "|", type: FormDataType.text),
|
||||||
|
FormDataModel(name: "times", value: "3", type: FormDataType.text),
|
||||||
|
],
|
||||||
requestHeaders: [
|
requestHeaders: [
|
||||||
NameValueModel(name: 'User-Agent', value: 'Test Agent'),
|
NameValueModel(name: 'User-Agent', value: 'Test Agent'),
|
||||||
],
|
],
|
||||||
|
requestBodyContentType: ContentType.formdata,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// POST request model with multipart body(text, file)
|
||||||
|
const requestModelPost6 = RequestModel(
|
||||||
|
id: 'post6',
|
||||||
|
url: 'https://api.apidash.dev/io/img',
|
||||||
|
method: HTTPVerb.post,
|
||||||
|
requestFormDataList: [
|
||||||
|
FormDataModel(name: "token", value: "xyz", type: FormDataType.text),
|
||||||
|
FormDataModel(
|
||||||
|
name: "imfile", value: "/Documents/up/1.png", type: FormDataType.file),
|
||||||
|
],
|
||||||
|
requestBodyContentType: ContentType.formdata,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// POST request model with multipart body and requestBody (the requestBody shouldn't be in codegen)
|
||||||
|
const requestModelPost7 = RequestModel(
|
||||||
|
id: 'post7',
|
||||||
|
url: 'https://api.apidash.dev/io/img',
|
||||||
|
method: HTTPVerb.post,
|
||||||
|
requestBody: r"""{
|
||||||
|
"text": "I LOVE Flutter"
|
||||||
|
}""",
|
||||||
|
requestFormDataList: [
|
||||||
|
FormDataModel(name: "token", value: "xyz", type: FormDataType.text),
|
||||||
|
FormDataModel(
|
||||||
|
name: "imfile", value: "/Documents/up/1.png", type: FormDataType.file),
|
||||||
|
],
|
||||||
|
requestBodyContentType: ContentType.formdata,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// POST request model with multipart body and requestParams
|
||||||
|
const requestModelPost8 = RequestModel(
|
||||||
|
id: 'post8',
|
||||||
|
url: 'https://api.apidash.dev/io/form',
|
||||||
|
method: HTTPVerb.post,
|
||||||
|
requestFormDataList: [
|
||||||
|
FormDataModel(name: "text", value: "API", type: FormDataType.text),
|
||||||
|
FormDataModel(name: "sep", value: "|", type: FormDataType.text),
|
||||||
|
FormDataModel(name: "times", value: "3", type: FormDataType.text),
|
||||||
|
],
|
||||||
|
requestParams: [
|
||||||
|
NameValueModel(name: 'size', value: '2'),
|
||||||
|
NameValueModel(name: 'len', value: '3'),
|
||||||
|
],
|
||||||
|
requestBodyContentType: ContentType.formdata,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// POST request model with multipart body(file and text), requestParams, requestHeaders and requestBody
|
||||||
|
const requestModelPost9 = RequestModel(
|
||||||
|
id: 'post9',
|
||||||
|
url: 'https://api.apidash.dev/io/img',
|
||||||
|
method: HTTPVerb.post,
|
||||||
|
requestBody: r"""{
|
||||||
|
"text": "I LOVE Flutter"
|
||||||
|
}""",
|
||||||
|
requestFormDataList: [
|
||||||
|
FormDataModel(name: "token", value: "xyz", type: FormDataType.text),
|
||||||
|
FormDataModel(
|
||||||
|
name: "imfile", value: "/Documents/up/1.png", type: FormDataType.file),
|
||||||
|
],
|
||||||
|
requestParams: [
|
||||||
|
NameValueModel(name: 'size', value: '2'),
|
||||||
|
NameValueModel(name: 'len', value: '3'),
|
||||||
|
],
|
||||||
|
requestHeaders: [
|
||||||
|
NameValueModel(name: 'User-Agent', value: 'Test Agent'),
|
||||||
|
NameValueModel(name: 'Keep-Alive', value: 'true'),
|
||||||
|
],
|
||||||
|
requestBodyContentType: ContentType.formdata,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// PUT request model
|
/// PUT request model
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:apidash/consts.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
import 'package:apidash/utils/file_utils.dart';
|
import 'package:apidash/utils/file_utils.dart';
|
||||||
|
|
||||||
@ -11,8 +12,13 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Test getShortPath', () {
|
test('Test getShortPath', () {
|
||||||
|
if (kIsWindows) {
|
||||||
|
String path = r"A\B\C\D.csv";
|
||||||
|
expect(getShortPath(path), r"...\C\D.csv");
|
||||||
|
} else {
|
||||||
String path = "A/B/C/D.csv";
|
String path = "A/B/C/D.csv";
|
||||||
expect(getShortPath(path), ".../C/D.csv");
|
expect(getShortPath(path), ".../C/D.csv");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Test getTempFileName', () {
|
test('Test getTempFileName', () {
|
||||||
|
@ -101,7 +101,7 @@ void main() {
|
|||||||
'request': {
|
'request': {
|
||||||
'method': 'GET',
|
'method': 'GET',
|
||||||
'url':
|
'url':
|
||||||
'https://api.foss42.com/humanize/social?num=8700000&digits=3&system=SS&add_space=true',
|
'https://api.apidash.dev/humanize/social?num=8700000&digits=3&system=SS&add_space=true',
|
||||||
'httpVersion': 'HTTP/1.1',
|
'httpVersion': 'HTTP/1.1',
|
||||||
'queryString': [
|
'queryString': [
|
||||||
{'name': 'num', 'value': '8700000', 'comment': ''},
|
{'name': 'num', 'value': '8700000', 'comment': ''},
|
||||||
@ -162,7 +162,7 @@ void main() {
|
|||||||
},
|
},
|
||||||
'request': {
|
'request': {
|
||||||
'method': 'POST',
|
'method': 'POST',
|
||||||
'url': 'https://api.foss42.com/case/lower',
|
'url': 'https://api.apidash.dev/case/lower',
|
||||||
'httpVersion': 'HTTP/1.1',
|
'httpVersion': 'HTTP/1.1',
|
||||||
'queryString': [],
|
'queryString': [],
|
||||||
'headers': [
|
'headers': [
|
||||||
@ -252,7 +252,7 @@ void main() {
|
|||||||
test('Test requestModelToHARJsonRequest exportMode=true', () {
|
test('Test requestModelToHARJsonRequest exportMode=true', () {
|
||||||
Map<String, dynamic> expectedResult = {
|
Map<String, dynamic> expectedResult = {
|
||||||
'method': 'POST',
|
'method': 'POST',
|
||||||
'url': 'https://api.foss42.com/case/lower',
|
'url': 'https://api.apidash.dev/case/lower',
|
||||||
'httpVersion': 'HTTP/1.1',
|
'httpVersion': 'HTTP/1.1',
|
||||||
'queryString': [],
|
'queryString': [],
|
||||||
'headers': [
|
'headers': [
|
||||||
@ -282,7 +282,7 @@ void main() {
|
|||||||
Map<String, dynamic> expectedResult = {
|
Map<String, dynamic> expectedResult = {
|
||||||
'method': 'GET',
|
'method': 'GET',
|
||||||
'url':
|
'url':
|
||||||
'https://api.foss42.com/humanize/social?num=8700000&digits=3&system=SS&add_space=true',
|
'https://api.apidash.dev/humanize/social?num=8700000&digits=3&system=SS&add_space=true',
|
||||||
'httpVersion': 'HTTP/1.1',
|
'httpVersion': 'HTTP/1.1',
|
||||||
'queryString': [
|
'queryString': [
|
||||||
{'name': 'num', 'value': '8700000'},
|
{'name': 'num', 'value': '8700000'},
|
||||||
@ -301,7 +301,7 @@ void main() {
|
|||||||
test('Test requestModelToHARJsonRequest useEnabled=true', () {
|
test('Test requestModelToHARJsonRequest useEnabled=true', () {
|
||||||
Map<String, dynamic> expectedResult = {
|
Map<String, dynamic> expectedResult = {
|
||||||
'method': 'GET',
|
'method': 'GET',
|
||||||
'url': 'https://api.foss42.com/humanize/social?num=8700000&digits=3',
|
'url': 'https://api.apidash.dev/humanize/social?num=8700000&digits=3',
|
||||||
'httpVersion': 'HTTP/1.1',
|
'httpVersion': 'HTTP/1.1',
|
||||||
'queryString': [
|
'queryString': [
|
||||||
{'name': 'num', 'value': '8700000'},
|
{'name': 'num', 'value': '8700000'},
|
||||||
|
@ -115,6 +115,7 @@ void main() {
|
|||||||
String pattern = "x-";
|
String pattern = "x-";
|
||||||
List<String> expected = [
|
List<String> expected = [
|
||||||
"Access-Control-Max-Age",
|
"Access-Control-Max-Age",
|
||||||
|
"Max-Forwards",
|
||||||
"X-Api-Key",
|
"X-Api-Key",
|
||||||
"X-Content-Type-Options",
|
"X-Content-Type-Options",
|
||||||
"X-CSRF-Token",
|
"X-CSRF-Token",
|
||||||
|
@ -19,14 +19,14 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Testing getRequestTitleFromUrl using url3', () {
|
test('Testing getRequestTitleFromUrl using url3', () {
|
||||||
String url3 = "https://api.foss42.com/country/codes";
|
String url3 = "https://api.apidash.dev/country/codes";
|
||||||
String title3Expected = "api.foss42.com/country/codes";
|
String title3Expected = "api.apidash.dev/country/codes";
|
||||||
expect(getRequestTitleFromUrl(url3), title3Expected);
|
expect(getRequestTitleFromUrl(url3), title3Expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Testing getRequestTitleFromUrl using url4', () {
|
test('Testing getRequestTitleFromUrl using url4', () {
|
||||||
String url4 = "api.foss42.com/country/data";
|
String url4 = "api.apidash.dev/country/data";
|
||||||
String title4Expected = "api.foss42.com/country/data";
|
String title4Expected = "api.apidash.dev/country/data";
|
||||||
expect(getRequestTitleFromUrl(url4), title4Expected);
|
expect(getRequestTitleFromUrl(url4), title4Expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -175,11 +175,11 @@ void main() {
|
|||||||
|
|
||||||
group("Testing getValidRequestUri", () {
|
group("Testing getValidRequestUri", () {
|
||||||
test('Testing getValidRequestUri for normal values', () {
|
test('Testing getValidRequestUri for normal values', () {
|
||||||
String url1 = "https://api.foss42.com/country/data";
|
String url1 = "https://api.apidash.dev/country/data";
|
||||||
const kvRow1 = NameValueModel(name: "code", value: "US");
|
const kvRow1 = NameValueModel(name: "code", value: "US");
|
||||||
Uri uri1Expected = Uri(
|
Uri uri1Expected = Uri(
|
||||||
scheme: 'https',
|
scheme: 'https',
|
||||||
host: 'api.foss42.com',
|
host: 'api.apidash.dev',
|
||||||
path: 'country/data',
|
path: 'country/data',
|
||||||
queryParameters: {'code': 'US'});
|
queryParameters: {'code': 'US'});
|
||||||
expect(getValidRequestUri(url1, [kvRow1]), (uri1Expected, null));
|
expect(getValidRequestUri(url1, [kvRow1]), (uri1Expected, null));
|
||||||
@ -193,11 +193,11 @@ void main() {
|
|||||||
expect(getValidRequestUri("", [kvRow3]), (null, "URL is missing!"));
|
expect(getValidRequestUri("", [kvRow3]), (null, "URL is missing!"));
|
||||||
});
|
});
|
||||||
test('Testing getValidRequestUri when https is not provided in url', () {
|
test('Testing getValidRequestUri when https is not provided in url', () {
|
||||||
String url4 = "api.foss42.com/country/data";
|
String url4 = "api.apidash.dev/country/data";
|
||||||
const kvRow4 = NameValueModel(name: "code", value: "US");
|
const kvRow4 = NameValueModel(name: "code", value: "US");
|
||||||
Uri uri4Expected = Uri(
|
Uri uri4Expected = Uri(
|
||||||
scheme: 'https',
|
scheme: 'https',
|
||||||
host: 'api.foss42.com',
|
host: 'api.apidash.dev',
|
||||||
path: 'country/data',
|
path: 'country/data',
|
||||||
queryParameters: {'code': 'US'});
|
queryParameters: {'code': 'US'});
|
||||||
expect(getValidRequestUri(url4, [kvRow4]), (uri4Expected, null));
|
expect(getValidRequestUri(url4, [kvRow4]), (uri4Expected, null));
|
||||||
@ -217,20 +217,20 @@ void main() {
|
|||||||
});
|
});
|
||||||
test('Testing getValidRequestUri when query params in both url and kvrow',
|
test('Testing getValidRequestUri when query params in both url and kvrow',
|
||||||
() {
|
() {
|
||||||
String url6 = "api.foss42.com/country/data?code=IND";
|
String url6 = "api.apidash.dev/country/data?code=IND";
|
||||||
const kvRow6 = NameValueModel(name: "code", value: "US");
|
const kvRow6 = NameValueModel(name: "code", value: "US");
|
||||||
Uri uri6Expected = Uri(
|
Uri uri6Expected = Uri(
|
||||||
scheme: 'https',
|
scheme: 'https',
|
||||||
host: 'api.foss42.com',
|
host: 'api.apidash.dev',
|
||||||
path: 'country/data',
|
path: 'country/data',
|
||||||
queryParameters: {'code': 'US'});
|
queryParameters: {'code': 'US'});
|
||||||
expect(getValidRequestUri(url6, [kvRow6]), (uri6Expected, null));
|
expect(getValidRequestUri(url6, [kvRow6]), (uri6Expected, null));
|
||||||
});
|
});
|
||||||
test('Testing getValidRequestUri when kvrow is null', () {
|
test('Testing getValidRequestUri when kvrow is null', () {
|
||||||
String url7 = "api.foss42.com/country/data?code=US";
|
String url7 = "api.apidash.dev/country/data?code=US";
|
||||||
Uri uri7Expected = Uri(
|
Uri uri7Expected = Uri(
|
||||||
scheme: 'https',
|
scheme: 'https',
|
||||||
host: 'api.foss42.com',
|
host: 'api.apidash.dev',
|
||||||
path: 'country/data',
|
path: 'country/data',
|
||||||
queryParameters: {'code': 'US'});
|
queryParameters: {'code': 'US'});
|
||||||
expect(getValidRequestUri(url7, null), (uri7Expected, null));
|
expect(getValidRequestUri(url7, null), (uri7Expected, null));
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// ignore_for_file: unused_import
|
||||||
|
// TODO: Added ignore to calculate code coverage
|
||||||
|
|
||||||
import 'package:apidash/main.dart';
|
import 'package:apidash/main.dart';
|
||||||
import 'package:apidash/app.dart';
|
import 'package:apidash/app.dart';
|
||||||
import 'package:apidash/common/utils.dart';
|
import 'package:apidash/common/utils.dart';
|
||||||
|
@ -36,8 +36,7 @@ void main() {
|
|||||||
theme: kThemeDataLight,
|
theme: kThemeDataLight,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: SendRequestButton(
|
body: SendRequestButton(
|
||||||
selectedId: '1',
|
isWorking: false,
|
||||||
sentRequestId: null,
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
changedValue = 'Send';
|
changedValue = 'Send';
|
||||||
},
|
},
|
||||||
@ -55,7 +54,8 @@ void main() {
|
|||||||
expect(changedValue, 'Send');
|
expect(changedValue, 'Send');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Testing for Send Request button when sentRequestId is not null',
|
testWidgets(
|
||||||
|
'Testing for Send Request button when RequestModel is viewed and is waiting for response',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
@ -63,32 +63,7 @@ void main() {
|
|||||||
theme: kThemeDataLight,
|
theme: kThemeDataLight,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: SendRequestButton(
|
body: SendRequestButton(
|
||||||
selectedId: '1',
|
isWorking: true,
|
||||||
sentRequestId: '2',
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(find.byIcon(Icons.send), findsNothing);
|
|
||||||
expect(find.text(kLabelBusy), findsOneWidget);
|
|
||||||
final button1 = find.byType(FilledButton);
|
|
||||||
expect(button1, findsOneWidget);
|
|
||||||
|
|
||||||
expect(tester.widget<FilledButton>(button1).enabled, isFalse);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('Testing for Send Request button when sentRequestId = selectedId',
|
|
||||||
(tester) async {
|
|
||||||
await tester.pumpWidget(
|
|
||||||
MaterialApp(
|
|
||||||
title: 'Send Request button',
|
|
||||||
theme: kThemeDataLight,
|
|
||||||
home: Scaffold(
|
|
||||||
body: SendRequestButton(
|
|
||||||
selectedId: '1',
|
|
||||||
sentRequestId: '1',
|
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -17,7 +17,7 @@ void main() {
|
|||||||
SidebarRequestCard(
|
SidebarRequestCard(
|
||||||
id: '23',
|
id: '23',
|
||||||
selectedId: '2',
|
selectedId: '2',
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
changedValue = 'Single Tapped';
|
changedValue = 'Single Tapped';
|
||||||
@ -34,11 +34,11 @@ void main() {
|
|||||||
|
|
||||||
expect(find.byType(InkWell), findsOneWidget);
|
expect(find.byType(InkWell), findsOneWidget);
|
||||||
|
|
||||||
expect(find.text('api.foss42.com'), findsOneWidget);
|
expect(find.text('api.apidash.dev'), findsOneWidget);
|
||||||
expect(find.widgetWithText(SizedBox, 'api.foss42.com'), findsOneWidget);
|
expect(find.widgetWithText(SizedBox, 'api.apidash.dev'), findsOneWidget);
|
||||||
expect(find.widgetWithText(Card, 'api.foss42.com'), findsOneWidget);
|
expect(find.widgetWithText(Card, 'api.apidash.dev'), findsOneWidget);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
var tappable = find.widgetWithText(Card, 'api.foss42.com');
|
var tappable = find.widgetWithText(Card, 'api.apidash.dev');
|
||||||
await tester.tap(tappable);
|
await tester.tap(tappable);
|
||||||
await tester.pumpAndSettle(const Duration(seconds: 2));
|
await tester.pumpAndSettle(const Duration(seconds: 2));
|
||||||
expect(changedValue, 'Single Tapped');
|
expect(changedValue, 'Single Tapped');
|
||||||
@ -63,7 +63,7 @@ void main() {
|
|||||||
id: '2',
|
id: '2',
|
||||||
selectedId: '2',
|
selectedId: '2',
|
||||||
editRequestId: '2',
|
editRequestId: '2',
|
||||||
url: 'https://api.foss42.com',
|
url: 'https://api.apidash.dev',
|
||||||
method: HTTPVerb.get,
|
method: HTTPVerb.get,
|
||||||
onTapOutsideNameEditor: () {
|
onTapOutsideNameEditor: () {
|
||||||
changedValue = 'Tapped Outside';
|
changedValue = 'Tapped Outside';
|
||||||
|
@ -9,7 +9,7 @@ void main() {
|
|||||||
String code = r'''import 'package:http/http.dart' as http;
|
String code = r'''import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/country/codes');
|
var uri = Uri.parse('https://api.apidash.dev/country/codes');
|
||||||
|
|
||||||
final response = await http.get(uri);
|
final response = await http.get(uri);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ void main() {
|
|||||||
String code = r'''import 'package:http/http.dart' as http;
|
String code = r'''import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/country/codes');
|
var uri = Uri.parse('https://api.apidash.dev/country/codes');
|
||||||
|
|
||||||
final response = await http.get(uri);
|
final response = await http.get(uri);
|
||||||
|
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:apidash/widgets/intro_message.dart';
|
import 'package:apidash/widgets/intro_message.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Testing Intro Message', (tester) async {
|
testWidgets('Testing Intro Message', (tester) async {
|
||||||
|
PackageInfo.setMockInitialValues(
|
||||||
|
appName: 'API Dash',
|
||||||
|
packageName: 'dev.apidash.apidash',
|
||||||
|
version: '1.0.0',
|
||||||
|
buildNumber: '1',
|
||||||
|
buildSignature: 'buildSignature');
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
title: 'Intro Message',
|
title: 'Intro Message',
|
||||||
@ -13,7 +20,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pump();
|
||||||
expect(find.text('Welcome to API Dash ⚡️'), findsOneWidget);
|
expect(find.text('Welcome to API Dash ⚡️'), findsOneWidget);
|
||||||
|
|
||||||
expect(find.byType(RichText), findsAtLeastNWidgets(1));
|
expect(find.byType(RichText), findsAtLeastNWidgets(1));
|
||||||
@ -25,5 +32,5 @@ void main() {
|
|||||||
expect(find.byIcon(Icons.star), findsOneWidget);
|
expect(find.byIcon(Icons.star), findsOneWidget);
|
||||||
expect(find.text('Star on GitHub'), findsOneWidget);
|
expect(find.text('Star on GitHub'), findsOneWidget);
|
||||||
await tester.tap(find.byIcon(Icons.star));
|
await tester.tap(find.byIcon(Icons.star));
|
||||||
}, skip: true);
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,85 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:apidash/widgets/markdown.dart';
|
import 'package:apidash/widgets/markdown.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Testing CustomMarkdown', (tester) async {
|
group('CustomMarkdown Widget Tests', () {
|
||||||
const markdown = CustomMarkdown(data: """Is a markdown ~`star on github`~
|
testWidgets('Testing CustomMarkdown buttons and tags renders',
|
||||||
|
(tester) async {
|
||||||
|
const markdown = CustomMarkdown(
|
||||||
|
data: """Is a markdown ~`star on github`~
|
||||||
|
|
||||||
#br
|
#br
|
||||||
#br
|
#br
|
||||||
|
|
||||||
~`github repo`~ ~`Discord Server`~""");
|
~`github repo`~ ~`Discord Server`~""",
|
||||||
await tester.pumpWidget(markdown);
|
);
|
||||||
//expectTextStrings(tester.allWidgets, <String>['Data1']);
|
await tester.pumpWidget(const MaterialApp(home: markdown));
|
||||||
}, skip: true);
|
|
||||||
|
expect(find.byIcon(Icons.star), findsOneWidget);
|
||||||
|
expect(find.text("star on github"), findsOneWidget);
|
||||||
|
|
||||||
|
expect(find.byIcon(Icons.discord), findsOneWidget);
|
||||||
|
expect(find.text("Discord Server"), findsOneWidget);
|
||||||
|
|
||||||
|
expect(find.byIcon(Icons.code_rounded), findsOneWidget);
|
||||||
|
expect(find.text("github repo"), findsOneWidget);
|
||||||
|
|
||||||
|
expect(find.text('#br'), findsNothing);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('CustomMarkdown renders correctly',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
await tester.pumpWidget(const MaterialApp(
|
||||||
|
home: CustomMarkdown(
|
||||||
|
data: '# Hello World\nThis is some *markdown* text.',
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
final headlineTextFinder = find.text('Hello World');
|
||||||
|
final markdownTextFinder = find.text('This is some markdown text.');
|
||||||
|
|
||||||
|
expect(headlineTextFinder, findsOneWidget);
|
||||||
|
expect(markdownTextFinder, findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('CustomMarkdown has proper text rendered',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
home: GestureDetector(
|
||||||
|
child: const CustomMarkdown(
|
||||||
|
data: '[Link Text](https://apidash.dev/)',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
await tester.tap(find.text('Link Text'));
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
|
expect(find.text('Link Text'), findsOneWidget);
|
||||||
|
|
||||||
|
expect(find.text('https://apidash.dev/'), findsNothing);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('CustomMarkdown creates hyperlink',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
bool linkTapped = false;
|
||||||
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
home: CustomMarkdown(
|
||||||
|
data: '[Link Text](https://apidash.dev/)',
|
||||||
|
onTapLink: (text, href, title) {
|
||||||
|
linkTapped = true;
|
||||||
|
expect(text, 'Link Text');
|
||||||
|
expect(href, 'https://apidash.dev/');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
));
|
||||||
|
expect(find.byType(Markdown), findsOneWidget);
|
||||||
|
final markdownWidget = tester.widget<Markdown>(find.byType(Markdown));
|
||||||
|
expect(markdownWidget.data, '[Link Text](https://apidash.dev/)');
|
||||||
|
await tester.tap(find.text('Link Text'));
|
||||||
|
expect(linkTapped, true);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -231,4 +231,26 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text(kSvgError), findsOneWidget);
|
expect(find.text(kSvgError), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('Testing when type/subtype is text/csv', (tester) async {
|
||||||
|
String csvDataString =
|
||||||
|
'Id,Name,Age\n1,John Doe,40\n2,Dbestech,41\n3,Voldermort,71\n4,Joe Biden,80\n5,Ryo Hanamura,35';
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
home: Scaffold(
|
||||||
|
body: Previewer(
|
||||||
|
type: kTypeText,
|
||||||
|
subtype: kSubTypeCsv,
|
||||||
|
bytes: Uint8List.fromList([]),
|
||||||
|
body: csvDataString,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(find.byType(DataTable), findsOneWidget);
|
||||||
|
expect(find.text('John Doe'), findsOneWidget);
|
||||||
|
expect(find.text('41'), findsOneWidget);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ void main() {
|
|||||||
RequestModel requestModel = const RequestModel(
|
RequestModel requestModel = const RequestModel(
|
||||||
id: '1',
|
id: '1',
|
||||||
method: HTTPVerb.post,
|
method: HTTPVerb.post,
|
||||||
url: 'api.foss42.com/case/lower',
|
url: 'api.apidash.dev/case/lower',
|
||||||
name: 'foss42 api',
|
name: 'foss42 api',
|
||||||
requestHeaders: [
|
requestHeaders: [
|
||||||
NameValueModel(name: 'content-length', value: '18'),
|
NameValueModel(name: 'content-length', value: '18'),
|
||||||
@ -372,7 +372,7 @@ void main() {
|
|||||||
String code = r'''import 'package:http/http.dart' as http;
|
String code = r'''import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var uri = Uri.parse('https://api.foss42.com/country/codes');
|
var uri = Uri.parse('https://api.apidash.dev/country/codes');
|
||||||
|
|
||||||
final response = await http.get(uri);
|
final response = await http.get(uri);
|
||||||
|
|
||||||
|
@ -57,4 +57,41 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('entering 123 for cell field'), findsOneWidget);
|
expect(find.text('entering 123 for cell field'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('URL Field sends request on enter keystroke', (tester) async {
|
||||||
|
bool wasSubmitCalled = false;
|
||||||
|
|
||||||
|
void testSubmit(String val) {
|
||||||
|
wasSubmitCalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
title: 'URL Field',
|
||||||
|
theme: kThemeDataDark,
|
||||||
|
home: Scaffold(
|
||||||
|
body: Column(children: [
|
||||||
|
URLField(
|
||||||
|
selectedId: '2',
|
||||||
|
onFieldSubmitted: testSubmit,
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// ensure URLField is blank
|
||||||
|
expect(find.byType(TextFormField), findsOneWidget);
|
||||||
|
expect(find.textContaining('Enter API endpoint '), findsOneWidget);
|
||||||
|
expect(wasSubmitCalled, false);
|
||||||
|
|
||||||
|
// modify value and press enter
|
||||||
|
var txtForm = find.byKey(const Key("url-2"));
|
||||||
|
await tester.enterText(txtForm, 'entering 123');
|
||||||
|
await tester.testTextInput.receiveAction(TextInputAction.done);
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
|
// check if value was updated
|
||||||
|
expect(wasSubmitCalled, true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user