mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
Migrate to API Dash APIs
This commit is contained in:
@ -499,7 +499,8 @@ const kRaiseIssue =
|
||||
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.foss42.com/country/codes";
|
||||
const kHintTextUrlCard =
|
||||
"Enter API endpoint like api.apidash.dev/country/codes";
|
||||
const kLabelPlusNew = "+ New";
|
||||
const kLabelSend = "Send";
|
||||
const kLabelSending = "Sending..";
|
||||
|
@ -65,7 +65,7 @@ class SettingsPage extends ConsumerWidget {
|
||||
hoverColor: kColorTransparent,
|
||||
title: const Text('Default URI Scheme'),
|
||||
subtitle: Text(
|
||||
'api.foss42.com → ${settings.defaultUriScheme}://api.foss42.com'),
|
||||
'api.apidash.dev → ${settings.defaultUriScheme}://api.apidash.dev'),
|
||||
trailing: DropdownMenu(
|
||||
onSelected: (value) {
|
||||
ref
|
||||
|
@ -8,7 +8,7 @@ void main() {
|
||||
|
||||
group('Test various Code generators', () {
|
||||
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"),
|
||||
expectedCode);
|
||||
});
|
||||
@ -18,7 +18,7 @@ void main() {
|
||||
|
||||
void main() async {
|
||||
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.data);
|
||||
} on DioException catch (e, s) {
|
||||
@ -40,7 +40,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
@ -62,7 +62,7 @@ void main() async {
|
||||
test('HAR', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "GET",
|
||||
"url": "https://api.foss42.com",
|
||||
"url": "https://api.apidash.dev",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": []
|
||||
@ -73,7 +73,7 @@ void main() async {
|
||||
|
||||
test('JS Axios', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: 'get'
|
||||
};
|
||||
|
||||
@ -95,7 +95,7 @@ axios(config)
|
||||
});
|
||||
|
||||
test('JS Fetch', () {
|
||||
const expectedCode = r"""let url = 'https://api.foss42.com';
|
||||
const expectedCode = r"""let url = 'https://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'GET'
|
||||
@ -128,7 +128,7 @@ import okhttp3.Request
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com"
|
||||
val url = "https://api.apidash.dev"
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
@ -151,7 +151,7 @@ fun main() {
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: 'get'
|
||||
};
|
||||
|
||||
@ -176,7 +176,7 @@ axios(config)
|
||||
test('Nodejs Fetch', () {
|
||||
const expectedCode = r"""import fetch from 'node-fetch';
|
||||
|
||||
let url = 'https://api.foss42.com';
|
||||
let url = 'https://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'GET'
|
||||
@ -206,7 +206,7 @@ fetch(url, options)
|
||||
test('Python 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", "")
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -223,7 +223,7 @@ print(data.decode("utf-8"))
|
||||
test('Python requests', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com'
|
||||
url = 'https://api.apidash.dev'
|
||||
|
||||
response = requests.get(url)
|
||||
|
||||
|
@ -7,25 +7,25 @@ void main() {
|
||||
|
||||
group('GET Request', () {
|
||||
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);
|
||||
});
|
||||
|
||||
test('GET 2', () {
|
||||
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);
|
||||
});
|
||||
|
||||
test('GET 3', () {
|
||||
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);
|
||||
});
|
||||
|
||||
test('GET 4', () {
|
||||
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);
|
||||
});
|
||||
|
||||
@ -44,7 +44,7 @@ void main() {
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
@ -57,13 +57,13 @@ void main() {
|
||||
|
||||
test('GET 9', () {
|
||||
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);
|
||||
});
|
||||
|
||||
test('GET 10', () {
|
||||
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'""";
|
||||
expect(
|
||||
curlCodeGen.getCode(
|
||||
@ -75,26 +75,26 @@ void main() {
|
||||
|
||||
test('GET 11', () {
|
||||
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'""";
|
||||
expect(curlCodeGen.getCode(requestModelGet11, "https"), expectedCode);
|
||||
});
|
||||
|
||||
test('GET 12', () {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
group('HEAD Request', () {
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
@ -102,7 +102,7 @@ void main() {
|
||||
group('POST Request', () {
|
||||
test('POST 1', () {
|
||||
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' \
|
||||
--data '{
|
||||
"text": "I LOVE Flutter"
|
||||
@ -112,7 +112,7 @@ void main() {
|
||||
|
||||
test('POST 2', () {
|
||||
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' \
|
||||
--data '{
|
||||
"text": "I LOVE Flutter"
|
||||
@ -122,7 +122,7 @@ void main() {
|
||||
|
||||
test('POST 3', () {
|
||||
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 'User-Agent: Test Agent' \
|
||||
--data '{
|
||||
|
@ -12,7 +12,7 @@ void main() {
|
||||
|
||||
void main() async {
|
||||
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.data);
|
||||
} on DioException catch (e, s) {
|
||||
@ -35,7 +35,7 @@ void main() async {
|
||||
try {
|
||||
final queryParams = {'code': 'US'};
|
||||
final response = await dio.Dio.get(
|
||||
'https://api.foss42.com/country/data',
|
||||
'https://api.apidash.dev/country/data',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
print(response.statusCode);
|
||||
@ -60,7 +60,7 @@ void main() async {
|
||||
try {
|
||||
final queryParams = {'code': 'IND'};
|
||||
final response = await dio.Dio.get(
|
||||
'https://api.foss42.com/country/data?code=US',
|
||||
'https://api.apidash.dev/country/data?code=US',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
print(response.statusCode);
|
||||
@ -91,7 +91,7 @@ void main() async {
|
||||
'trailing_zeros': 'true',
|
||||
};
|
||||
final response = await dio.Dio.get(
|
||||
'https://api.foss42.com/humanize/social',
|
||||
'https://api.apidash.dev/humanize/social',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
print(response.statusCode);
|
||||
@ -166,7 +166,7 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
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.data);
|
||||
} on DioException catch (e, s) {
|
||||
@ -219,7 +219,7 @@ void main() async {
|
||||
'add_space': 'true',
|
||||
};
|
||||
final response = await dio.Dio.get(
|
||||
'https://api.foss42.com/humanize/social',
|
||||
'https://api.apidash.dev/humanize/social',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
print(response.statusCode);
|
||||
@ -244,7 +244,7 @@ void main() async {
|
||||
try {
|
||||
final headers = {'User-Agent': 'Test Agent'};
|
||||
final response = await dio.Dio.get(
|
||||
'https://api.foss42.com/humanize/social',
|
||||
'https://api.apidash.dev/humanize/social',
|
||||
options: Options(headers: headers),
|
||||
);
|
||||
print(response.statusCode);
|
||||
@ -278,7 +278,7 @@ void main() async {
|
||||
};
|
||||
final headers = {'User-Agent': 'Test Agent'};
|
||||
final response = await dio.Dio.get(
|
||||
'https://api.foss42.com/humanize/social',
|
||||
'https://api.apidash.dev/humanize/social',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
);
|
||||
@ -302,7 +302,7 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
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.data);
|
||||
} on DioException catch (e, s) {
|
||||
@ -325,7 +325,7 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
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.data);
|
||||
} on DioException catch (e, s) {
|
||||
@ -346,7 +346,7 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
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.data);
|
||||
} on DioException catch (e, s) {
|
||||
@ -373,7 +373,7 @@ void main() async {
|
||||
"text": "I LOVE Flutter"
|
||||
}''';
|
||||
final response = await dio.Dio.post(
|
||||
'https://api.foss42.com/case/lower',
|
||||
'https://api.apidash.dev/case/lower',
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
@ -401,7 +401,7 @@ void main() async {
|
||||
"text": "I LOVE Flutter"
|
||||
}''');
|
||||
final response = await dio.Dio.post(
|
||||
'https://api.foss42.com/case/lower',
|
||||
'https://api.apidash.dev/case/lower',
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
@ -430,7 +430,7 @@ void main() async {
|
||||
"text": "I LOVE Flutter"
|
||||
}''');
|
||||
final response = await dio.Dio.post(
|
||||
'https://api.foss42.com/case/lower',
|
||||
'https://api.apidash.dev/case/lower',
|
||||
options: Options(headers: headers),
|
||||
data: data,
|
||||
);
|
||||
|
@ -11,7 +11,7 @@ void main() {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
@ -32,7 +32,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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'};
|
||||
uri = uri.replace(queryParameters: queryParams);
|
||||
@ -57,7 +57,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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 urlQueryParams = Map<String, String>.from(uri.queryParameters);
|
||||
@ -83,7 +83,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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 = {
|
||||
'num': '8700000',
|
||||
@ -168,7 +168,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
@ -218,7 +218,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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 = {
|
||||
'num': '8700000',
|
||||
@ -245,7 +245,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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'};
|
||||
|
||||
@ -276,7 +276,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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 = {
|
||||
'num': '8700000',
|
||||
@ -308,7 +308,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
@ -331,7 +331,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
@ -352,7 +352,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
@ -375,7 +375,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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'''{
|
||||
"text": "I LOVE Flutter"
|
||||
@ -406,7 +406,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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'''{
|
||||
"text": "I LOVE Flutter"
|
||||
@ -437,7 +437,7 @@ void main() async {
|
||||
const expectedCode = r"""import 'package:http/http.dart' as http;
|
||||
|
||||
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'''{
|
||||
"text": "I LOVE Flutter"
|
||||
|
@ -9,7 +9,7 @@ void main() {
|
||||
test('GET 1', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "GET",
|
||||
"url": "https://api.foss42.com",
|
||||
"url": "https://api.apidash.dev",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": []
|
||||
@ -20,7 +20,7 @@ void main() {
|
||||
test('GET 2', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "GET",
|
||||
"url": "https://api.foss42.com/country/data?code=US",
|
||||
"url": "https://api.apidash.dev/country/data?code=US",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [
|
||||
{
|
||||
@ -36,7 +36,7 @@ void main() {
|
||||
test('GET 3', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "GET",
|
||||
"url": "https://api.foss42.com/country/data?code=IND",
|
||||
"url": "https://api.apidash.dev/country/data?code=IND",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [
|
||||
{
|
||||
@ -52,7 +52,7 @@ void main() {
|
||||
test('GET 4', () {
|
||||
const expectedCode = r"""{
|
||||
"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",
|
||||
"queryString": [
|
||||
{
|
||||
@ -121,7 +121,7 @@ void main() {
|
||||
test('GET 7', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "GET",
|
||||
"url": "https://api.foss42.com",
|
||||
"url": "https://api.apidash.dev",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": []
|
||||
@ -153,7 +153,7 @@ void main() {
|
||||
test('GET 9', () {
|
||||
const expectedCode = r"""{
|
||||
"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",
|
||||
"queryString": [
|
||||
{
|
||||
@ -173,7 +173,7 @@ void main() {
|
||||
test('GET 10', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "GET",
|
||||
"url": "https://api.foss42.com/humanize/social",
|
||||
"url": "https://api.apidash.dev/humanize/social",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": [
|
||||
@ -194,7 +194,7 @@ void main() {
|
||||
test('GET 11', () {
|
||||
const expectedCode = r"""{
|
||||
"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",
|
||||
"queryString": [
|
||||
{
|
||||
@ -219,7 +219,7 @@ void main() {
|
||||
test('GET 12', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "GET",
|
||||
"url": "https://api.foss42.com/humanize/social",
|
||||
"url": "https://api.apidash.dev/humanize/social",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": []
|
||||
@ -232,7 +232,7 @@ void main() {
|
||||
test('HEAD 1', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "HEAD",
|
||||
"url": "https://api.foss42.com",
|
||||
"url": "https://api.apidash.dev",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": []
|
||||
@ -243,7 +243,7 @@ void main() {
|
||||
test('HEAD 2', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "HEAD",
|
||||
"url": "http://api.foss42.com",
|
||||
"url": "http://api.apidash.dev",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": []
|
||||
@ -256,7 +256,7 @@ void main() {
|
||||
test('POST 1', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "POST",
|
||||
"url": "https://api.foss42.com/case/lower",
|
||||
"url": "https://api.apidash.dev/case/lower",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": [
|
||||
@ -276,7 +276,7 @@ void main() {
|
||||
test('POST 2', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "POST",
|
||||
"url": "https://api.foss42.com/case/lower",
|
||||
"url": "https://api.apidash.dev/case/lower",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": [
|
||||
@ -296,7 +296,7 @@ void main() {
|
||||
test('POST 3', () {
|
||||
const expectedCode = r"""{
|
||||
"method": "POST",
|
||||
"url": "https://api.foss42.com/case/lower",
|
||||
"url": "https://api.apidash.dev/case/lower",
|
||||
"httpVersion": "HTTP/1.1",
|
||||
"queryString": [],
|
||||
"headers": [
|
||||
|
@ -8,7 +8,7 @@ void main() {
|
||||
group('GET Request', () {
|
||||
test('GET 1', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: 'get'
|
||||
};
|
||||
|
||||
@ -29,7 +29,7 @@ axios(config)
|
||||
|
||||
test('GET 2', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/country/data',
|
||||
url: 'https://api.apidash.dev/country/data',
|
||||
method: 'get',
|
||||
params: {
|
||||
"code": "US"
|
||||
@ -53,7 +53,7 @@ axios(config)
|
||||
|
||||
test('GET 3', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/country/data',
|
||||
url: 'https://api.apidash.dev/country/data',
|
||||
method: 'get',
|
||||
params: {
|
||||
"code": "IND"
|
||||
@ -77,7 +77,7 @@ axios(config)
|
||||
|
||||
test('GET 4', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get',
|
||||
params: {
|
||||
"num": "8700000",
|
||||
@ -156,7 +156,7 @@ axios(config)
|
||||
|
||||
test('GET 7', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: 'get'
|
||||
};
|
||||
|
||||
@ -204,7 +204,7 @@ axios(config)
|
||||
|
||||
test('GET 9', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get',
|
||||
params: {
|
||||
"num": "8700000",
|
||||
@ -229,7 +229,7 @@ axios(config)
|
||||
|
||||
test('GET 10', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get',
|
||||
headers: {
|
||||
"User-Agent": "Test Agent"
|
||||
@ -258,7 +258,7 @@ axios(config)
|
||||
|
||||
test('GET 11', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get',
|
||||
params: {
|
||||
"num": "8700000",
|
||||
@ -286,7 +286,7 @@ axios(config)
|
||||
|
||||
test('GET 12', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get'
|
||||
};
|
||||
|
||||
@ -309,7 +309,7 @@ axios(config)
|
||||
group('HEAD Request', () {
|
||||
test('HEAD 1', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: 'head'
|
||||
};
|
||||
|
||||
@ -330,7 +330,7 @@ axios(config)
|
||||
|
||||
test('HEAD 2', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'http://api.foss42.com',
|
||||
url: 'http://api.apidash.dev',
|
||||
method: 'head'
|
||||
};
|
||||
|
||||
@ -353,7 +353,7 @@ axios(config)
|
||||
group('POST Request', () {
|
||||
test('POST 1', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"Content-Type": "text/plain"
|
||||
@ -378,7 +378,7 @@ axios(config)
|
||||
|
||||
test('POST 2', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
@ -403,7 +403,7 @@ axios(config)
|
||||
|
||||
test('POST 3', () {
|
||||
const expectedCode = r"""let config = {
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
@ -7,7 +7,7 @@ void main() {
|
||||
|
||||
group('GET Request', () {
|
||||
test('GET 1', () {
|
||||
const expectedCode = r"""let url = 'https://api.foss42.com';
|
||||
const expectedCode = r"""let url = 'https://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'GET'
|
||||
@ -33,7 +33,7 @@ fetch(url, options)
|
||||
|
||||
test('GET 2', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -59,7 +59,7 @@ fetch(url, options)
|
||||
|
||||
test('GET 3', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -85,7 +85,7 @@ fetch(url, options)
|
||||
|
||||
test('GET 4', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -168,7 +168,7 @@ fetch(url, options)
|
||||
});
|
||||
|
||||
test('GET 7', () {
|
||||
const expectedCode = r"""let url = 'https://api.foss42.com';
|
||||
const expectedCode = r"""let url = 'https://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'GET'
|
||||
@ -223,7 +223,7 @@ fetch(url, options)
|
||||
|
||||
test('GET 9', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -249,7 +249,7 @@ fetch(url, options)
|
||||
|
||||
test('GET 10', () {
|
||||
const expectedCode =
|
||||
r"""let url = 'https://api.foss42.com/humanize/social';
|
||||
r"""let url = 'https://api.apidash.dev/humanize/social';
|
||||
|
||||
let options = {
|
||||
method: 'GET',
|
||||
@ -283,7 +283,7 @@ fetch(url, options)
|
||||
|
||||
test('GET 11', () {
|
||||
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 = {
|
||||
method: 'GET',
|
||||
@ -312,7 +312,7 @@ fetch(url, options)
|
||||
|
||||
test('GET 12', () {
|
||||
const expectedCode =
|
||||
r"""let url = 'https://api.foss42.com/humanize/social';
|
||||
r"""let url = 'https://api.apidash.dev/humanize/social';
|
||||
|
||||
let options = {
|
||||
method: 'GET'
|
||||
@ -339,7 +339,7 @@ fetch(url, options)
|
||||
|
||||
group('HEAD Request', () {
|
||||
test('HEAD 1', () {
|
||||
const expectedCode = r"""let url = 'https://api.foss42.com';
|
||||
const expectedCode = r"""let url = 'https://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'HEAD'
|
||||
@ -364,7 +364,7 @@ fetch(url, options)
|
||||
});
|
||||
|
||||
test('HEAD 2', () {
|
||||
const expectedCode = r"""let url = 'http://api.foss42.com';
|
||||
const expectedCode = r"""let url = 'http://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'HEAD'
|
||||
@ -391,7 +391,7 @@ fetch(url, options)
|
||||
|
||||
group('POST Request', () {
|
||||
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 = {
|
||||
method: 'POST',
|
||||
@ -421,7 +421,7 @@ fetch(url, options)
|
||||
});
|
||||
|
||||
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 = {
|
||||
method: 'POST',
|
||||
@ -451,7 +451,7 @@ fetch(url, options)
|
||||
});
|
||||
|
||||
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 = {
|
||||
method: 'POST',
|
||||
|
@ -13,7 +13,7 @@ import okhttp3.Request
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com"
|
||||
val url = "https://api.apidash.dev"
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
@ -38,7 +38,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
fun main() {
|
||||
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")
|
||||
.build()
|
||||
|
||||
@ -65,7 +65,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
fun main() {
|
||||
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")
|
||||
.build()
|
||||
|
||||
@ -92,7 +92,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
fun main() {
|
||||
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("digits", "3")
|
||||
.addQueryParameter("system", "SS")
|
||||
@ -175,7 +175,7 @@ import okhttp3.Request
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com"
|
||||
val url = "https://api.apidash.dev"
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
@ -228,7 +228,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
fun main() {
|
||||
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("add_space", "true")
|
||||
.build()
|
||||
@ -255,7 +255,7 @@ import okhttp3.Request
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com/humanize/social"
|
||||
val url = "https://api.apidash.dev/humanize/social"
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
@ -285,7 +285,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
fun main() {
|
||||
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("digits", "3")
|
||||
.build()
|
||||
@ -313,7 +313,7 @@ import okhttp3.Request
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com/humanize/social"
|
||||
val url = "https://api.apidash.dev/humanize/social"
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
@ -339,7 +339,7 @@ import okhttp3.Request
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com"
|
||||
val url = "https://api.apidash.dev"
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
@ -363,7 +363,7 @@ import okhttp3.Request
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "http://api.foss42.com"
|
||||
val url = "http://api.apidash.dev"
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
@ -391,7 +391,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com/case/lower"
|
||||
val url = "https://api.apidash.dev/case/lower"
|
||||
|
||||
val mediaType = "text/plain".toMediaType()
|
||||
|
||||
@ -423,7 +423,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com/case/lower"
|
||||
val url = "https://api.apidash.dev/case/lower"
|
||||
|
||||
val mediaType = "application/json".toMediaType()
|
||||
|
||||
@ -455,7 +455,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
||||
fun main() {
|
||||
val client = OkHttpClient()
|
||||
|
||||
val url = "https://api.foss42.com/case/lower"
|
||||
val url = "https://api.apidash.dev/case/lower"
|
||||
|
||||
val mediaType = "application/json".toMediaType()
|
||||
|
||||
|
@ -10,7 +10,7 @@ void main() {
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: 'get'
|
||||
};
|
||||
|
||||
@ -33,7 +33,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/country/data',
|
||||
url: 'https://api.apidash.dev/country/data',
|
||||
method: 'get',
|
||||
params: {
|
||||
"code": "US"
|
||||
@ -59,7 +59,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/country/data',
|
||||
url: 'https://api.apidash.dev/country/data',
|
||||
method: 'get',
|
||||
params: {
|
||||
"code": "IND"
|
||||
@ -85,7 +85,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get',
|
||||
params: {
|
||||
"num": "8700000",
|
||||
@ -170,7 +170,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: 'get'
|
||||
};
|
||||
|
||||
@ -222,7 +222,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get',
|
||||
params: {
|
||||
"num": "8700000",
|
||||
@ -249,7 +249,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get',
|
||||
headers: {
|
||||
"User-Agent": "Test Agent"
|
||||
@ -280,7 +280,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get',
|
||||
params: {
|
||||
"num": "8700000",
|
||||
@ -310,7 +310,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: 'get'
|
||||
};
|
||||
|
||||
@ -335,7 +335,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: 'head'
|
||||
};
|
||||
|
||||
@ -358,7 +358,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'http://api.foss42.com',
|
||||
url: 'http://api.apidash.dev',
|
||||
method: 'head'
|
||||
};
|
||||
|
||||
@ -383,7 +383,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"Content-Type": "text/plain"
|
||||
@ -410,7 +410,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
@ -437,7 +437,7 @@ axios(config)
|
||||
const expectedCode = r"""import axios from 'axios';
|
||||
|
||||
let config = {
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
@ -9,7 +9,7 @@ void main() {
|
||||
test('GET 1', () {
|
||||
const expectedCode = r"""import fetch from 'node-fetch';
|
||||
|
||||
let url = 'https://api.foss42.com';
|
||||
let url = 'https://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'GET'
|
||||
@ -36,7 +36,7 @@ fetch(url, options)
|
||||
test('GET 2', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -63,7 +63,7 @@ fetch(url, options)
|
||||
test('GET 3', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -90,7 +90,7 @@ fetch(url, options)
|
||||
test('GET 4', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -177,7 +177,7 @@ fetch(url, options)
|
||||
test('GET 7', () {
|
||||
const expectedCode = r"""import fetch from 'node-fetch';
|
||||
|
||||
let url = 'https://api.foss42.com';
|
||||
let url = 'https://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'GET'
|
||||
@ -234,7 +234,7 @@ fetch(url, options)
|
||||
test('GET 9', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -261,7 +261,7 @@ fetch(url, options)
|
||||
test('GET 10', () {
|
||||
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 = {
|
||||
method: 'GET',
|
||||
@ -296,7 +296,7 @@ fetch(url, options)
|
||||
test('GET 11', () {
|
||||
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 = {
|
||||
method: 'GET',
|
||||
@ -326,7 +326,7 @@ fetch(url, options)
|
||||
test('GET 12', () {
|
||||
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 = {
|
||||
method: 'GET'
|
||||
@ -355,7 +355,7 @@ fetch(url, options)
|
||||
test('HEAD 1', () {
|
||||
const expectedCode = r"""import fetch from 'node-fetch';
|
||||
|
||||
let url = 'https://api.foss42.com';
|
||||
let url = 'https://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'HEAD'
|
||||
@ -382,7 +382,7 @@ fetch(url, options)
|
||||
test('HEAD 2', () {
|
||||
const expectedCode = r"""import fetch from 'node-fetch';
|
||||
|
||||
let url = 'http://api.foss42.com';
|
||||
let url = 'http://api.apidash.dev';
|
||||
|
||||
let options = {
|
||||
method: 'HEAD'
|
||||
@ -411,7 +411,7 @@ fetch(url, options)
|
||||
test('POST 1', () {
|
||||
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 = {
|
||||
method: 'POST',
|
||||
@ -443,7 +443,7 @@ fetch(url, options)
|
||||
test('POST 2', () {
|
||||
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 = {
|
||||
method: 'POST',
|
||||
@ -475,7 +475,7 @@ fetch(url, options)
|
||||
test('POST 3', () {
|
||||
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 = {
|
||||
method: 'POST',
|
||||
|
@ -9,7 +9,7 @@ void main() {
|
||||
test('GET 1', () {
|
||||
const expectedCode = r"""import http.client
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("GET", "")
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -30,7 +30,7 @@ queryParams = {
|
||||
}
|
||||
queryParamsStr = '?' + urlencode(queryParams)
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("GET", "/country/data" + queryParamsStr)
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -51,7 +51,7 @@ queryParams = {
|
||||
}
|
||||
queryParamsStr = '?' + urlencode(queryParams)
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("GET", "/country/data" + queryParamsStr)
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -76,7 +76,7 @@ queryParams = {
|
||||
}
|
||||
queryParamsStr = '?' + urlencode(queryParams)
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("GET", "/humanize/social" + queryParamsStr)
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -137,7 +137,7 @@ print(data.decode("utf-8"))
|
||||
test('GET 7', () {
|
||||
const expectedCode = r"""import http.client
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("GET", "")
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -185,7 +185,7 @@ queryParams = {
|
||||
}
|
||||
queryParamsStr = '?' + urlencode(queryParams)
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("GET", "/humanize/social" + queryParamsStr)
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -204,7 +204,7 @@ headers = {
|
||||
"User-Agent": "Test Agent"
|
||||
}
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("GET", "/humanize/social",
|
||||
headers= headers)
|
||||
|
||||
@ -235,7 +235,7 @@ headers = {
|
||||
"User-Agent": "Test Agent"
|
||||
}
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("GET", "/humanize/social" + queryParamsStr,
|
||||
headers= headers)
|
||||
|
||||
@ -251,7 +251,7 @@ print(data.decode("utf-8"))
|
||||
test('GET 12', () {
|
||||
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")
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -268,7 +268,7 @@ print(data.decode("utf-8"))
|
||||
test('HEAD 1', () {
|
||||
const expectedCode = r"""import http.client
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("HEAD", "")
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -283,7 +283,7 @@ print(data.decode("utf-8"))
|
||||
test('HEAD 2', () {
|
||||
const expectedCode = r"""import http.client
|
||||
|
||||
conn = http.client.HTTPConnection("api.foss42.com")
|
||||
conn = http.client.HTTPConnection("api.apidash.dev")
|
||||
conn.request("HEAD", "")
|
||||
|
||||
res = conn.getresponse()
|
||||
@ -308,7 +308,7 @@ headers = {
|
||||
"content-type": "text/plain"
|
||||
}
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("POST", "/case/lower",
|
||||
body= body,
|
||||
headers= headers)
|
||||
@ -333,7 +333,7 @@ headers = {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("POST", "/case/lower",
|
||||
body= body,
|
||||
headers= headers)
|
||||
@ -359,7 +359,7 @@ headers = {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
|
||||
conn = http.client.HTTPSConnection("api.foss42.com")
|
||||
conn = http.client.HTTPSConnection("api.apidash.dev")
|
||||
conn.request("POST", "/case/lower",
|
||||
body= body,
|
||||
headers= headers)
|
||||
|
@ -9,7 +9,7 @@ void main() {
|
||||
test('GET 1', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com'
|
||||
url = 'https://api.apidash.dev'
|
||||
|
||||
response = requests.get(url)
|
||||
|
||||
@ -23,7 +23,7 @@ print('Response Body:', response.text)
|
||||
test('GET 2', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/country/data'
|
||||
url = 'https://api.apidash.dev/country/data'
|
||||
|
||||
params = {
|
||||
"code": "US"
|
||||
@ -41,7 +41,7 @@ print('Response Body:', response.text)
|
||||
test('GET 3', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/country/data'
|
||||
url = 'https://api.apidash.dev/country/data'
|
||||
|
||||
params = {
|
||||
"code": "IND"
|
||||
@ -59,7 +59,7 @@ print('Response Body:', response.text)
|
||||
test('GET 4', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/humanize/social'
|
||||
url = 'https://api.apidash.dev/humanize/social'
|
||||
|
||||
params = {
|
||||
"num": "8700000",
|
||||
@ -121,7 +121,7 @@ print('Response Body:', response.text)
|
||||
test('GET 7', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com'
|
||||
url = 'https://api.apidash.dev'
|
||||
|
||||
response = requests.get(url)
|
||||
|
||||
@ -157,7 +157,7 @@ print('Response Body:', response.text)
|
||||
test('GET 9', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/humanize/social'
|
||||
url = 'https://api.apidash.dev/humanize/social'
|
||||
|
||||
params = {
|
||||
"num": "8700000",
|
||||
@ -176,7 +176,7 @@ print('Response Body:', response.text)
|
||||
test('GET 10', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/humanize/social'
|
||||
url = 'https://api.apidash.dev/humanize/social'
|
||||
|
||||
headers = {
|
||||
"User-Agent": "Test Agent"
|
||||
@ -198,7 +198,7 @@ print('Response Body:', response.text)
|
||||
test('GET 11', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/humanize/social'
|
||||
url = 'https://api.apidash.dev/humanize/social'
|
||||
|
||||
params = {
|
||||
"num": "8700000",
|
||||
@ -221,7 +221,7 @@ print('Response Body:', response.text)
|
||||
test('GET 12', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/humanize/social'
|
||||
url = 'https://api.apidash.dev/humanize/social'
|
||||
|
||||
response = requests.get(url)
|
||||
|
||||
@ -237,7 +237,7 @@ print('Response Body:', response.text)
|
||||
test('HEAD 1', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com'
|
||||
url = 'https://api.apidash.dev'
|
||||
|
||||
response = requests.head(url)
|
||||
|
||||
@ -251,7 +251,7 @@ print('Response Body:', response.text)
|
||||
test('HEAD 2', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'http://api.foss42.com'
|
||||
url = 'http://api.apidash.dev'
|
||||
|
||||
response = requests.head(url)
|
||||
|
||||
@ -267,7 +267,7 @@ print('Response Body:', response.text)
|
||||
test('POST 1', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/case/lower'
|
||||
url = 'https://api.apidash.dev/case/lower'
|
||||
|
||||
payload = r'''{
|
||||
"text": "I LOVE Flutter"
|
||||
@ -289,7 +289,7 @@ print('Response Body:', response.text)
|
||||
test('POST 2', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/case/lower'
|
||||
url = 'https://api.apidash.dev/case/lower'
|
||||
|
||||
payload = {
|
||||
"text": "I LOVE Flutter"
|
||||
@ -307,7 +307,7 @@ print('Response Body:', response.text)
|
||||
test('POST 3', () {
|
||||
const expectedCode = r"""import requests
|
||||
|
||||
url = 'https://api.foss42.com/case/lower'
|
||||
url = 'https://api.apidash.dev/case/lower'
|
||||
|
||||
payload = {
|
||||
"text": "I LOVE Flutter"
|
||||
|
@ -52,7 +52,7 @@ void main() {
|
||||
RequestModel requestModel = RequestModel(
|
||||
id: '1',
|
||||
method: HTTPVerb.post,
|
||||
url: 'api.foss42.com/case/lower',
|
||||
url: 'api.apidash.dev/case/lower',
|
||||
name: 'foss42 api',
|
||||
requestHeaders: const [
|
||||
NameValueModel(name: 'content-length', value: '18'),
|
||||
@ -69,7 +69,7 @@ void main() {
|
||||
RequestModel requestModelDup = const RequestModel(
|
||||
id: '1',
|
||||
method: HTTPVerb.post,
|
||||
url: 'api.foss42.com/case/lower',
|
||||
url: 'api.apidash.dev/case/lower',
|
||||
name: 'foss42 api',
|
||||
requestHeaders: [
|
||||
NameValueModel(name: 'content-length', value: '18'),
|
||||
@ -84,7 +84,7 @@ void main() {
|
||||
RequestModel requestModelCopy = const RequestModel(
|
||||
id: '1',
|
||||
method: HTTPVerb.post,
|
||||
url: 'api.foss42.com/case/lower',
|
||||
url: 'api.apidash.dev/case/lower',
|
||||
name: 'foss42 api (copy)',
|
||||
requestHeaders: [
|
||||
NameValueModel(name: 'content-length', value: '18'),
|
||||
@ -99,7 +99,7 @@ void main() {
|
||||
Map<String, dynamic> requestModelAsJson = {
|
||||
"id": '1',
|
||||
"method": 'post',
|
||||
"url": 'api.foss42.com/case/lower',
|
||||
"url": 'api.apidash.dev/case/lower',
|
||||
"name": 'foss42 api',
|
||||
'description': '',
|
||||
"requestHeaders": {
|
||||
@ -138,7 +138,7 @@ void main() {
|
||||
final requestModeDupString = [
|
||||
"Request Id: 1",
|
||||
"Request Method: post",
|
||||
"Request URL: api.foss42.com/case/lower",
|
||||
"Request URL: api.apidash.dev/case/lower",
|
||||
"Request Name: foss42 api",
|
||||
"Request Description: ",
|
||||
"Request Tab Index: 0",
|
||||
|
@ -81,19 +81,19 @@ void main() {
|
||||
|
||||
test('Testing fromResponse', () async {
|
||||
final response = await http.get(
|
||||
Uri.parse('https://api.foss42.com/'),
|
||||
Uri.parse('https://api.apidash.dev/'),
|
||||
);
|
||||
final responseData = responseModel.fromResponse(response: response);
|
||||
expect(responseData.statusCode, 200);
|
||||
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, '''{
|
||||
"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 {
|
||||
final response = await http.get(
|
||||
Uri.parse('https://foss42.com/'),
|
||||
Uri.parse('https://apidash.dev/'),
|
||||
);
|
||||
final responseData = responseModel.fromResponse(response: response);
|
||||
expect(responseData.statusCode, 200);
|
||||
|
@ -4,14 +4,14 @@ import 'package:apidash/consts.dart';
|
||||
/// Basic GET request model
|
||||
const requestModelGet1 = RequestModel(
|
||||
id: 'get1',
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: HTTPVerb.get,
|
||||
);
|
||||
|
||||
/// GET request model with query params
|
||||
const requestModelGet2 = RequestModel(
|
||||
id: 'get2',
|
||||
url: 'https://api.foss42.com/country/data',
|
||||
url: 'https://api.apidash.dev/country/data',
|
||||
method: HTTPVerb.get,
|
||||
requestParams: [
|
||||
NameValueModel(name: 'code', value: 'US'),
|
||||
@ -21,7 +21,7 @@ const requestModelGet2 = RequestModel(
|
||||
/// GET request model with override query params
|
||||
const requestModelGet3 = RequestModel(
|
||||
id: 'get3',
|
||||
url: 'https://api.foss42.com/country/data?code=US',
|
||||
url: 'https://api.apidash.dev/country/data?code=US',
|
||||
method: HTTPVerb.get,
|
||||
requestParams: [
|
||||
NameValueModel(name: 'code', value: 'IND'),
|
||||
@ -31,7 +31,7 @@ const requestModelGet3 = RequestModel(
|
||||
/// GET request model with different types of query params
|
||||
const requestModelGet4 = RequestModel(
|
||||
id: 'get4',
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: HTTPVerb.get,
|
||||
requestParams: [
|
||||
NameValueModel(name: 'num', value: '8700000'),
|
||||
@ -68,7 +68,7 @@ const requestModelGet6 = RequestModel(
|
||||
/// GET request model with body
|
||||
const requestModelGet7 = RequestModel(
|
||||
id: 'get7',
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: HTTPVerb.get,
|
||||
requestBodyContentType: ContentType.text,
|
||||
requestBody:
|
||||
@ -93,7 +93,7 @@ const requestModelGet8 = RequestModel(
|
||||
/// GET request model with some params enabled
|
||||
const requestModelGet9 = RequestModel(
|
||||
id: 'get9',
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: HTTPVerb.get,
|
||||
requestParams: [
|
||||
NameValueModel(name: 'num', value: '8700000'),
|
||||
@ -112,7 +112,7 @@ const requestModelGet9 = RequestModel(
|
||||
/// GET Request model with some headers enabled
|
||||
const requestModelGet10 = RequestModel(
|
||||
id: 'get10',
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: HTTPVerb.get,
|
||||
requestHeaders: [
|
||||
NameValueModel(name: 'User-Agent', value: 'Test Agent'),
|
||||
@ -127,7 +127,7 @@ const requestModelGet10 = RequestModel(
|
||||
/// GET Request model with some headers & URL parameters enabled
|
||||
const requestModelGet11 = RequestModel(
|
||||
id: 'get11',
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: HTTPVerb.get,
|
||||
requestParams: [
|
||||
NameValueModel(name: 'num', value: '8700000'),
|
||||
@ -154,7 +154,7 @@ const requestModelGet11 = RequestModel(
|
||||
/// Request model with all headers & URL parameters disabled
|
||||
const requestModelGet12 = RequestModel(
|
||||
id: 'get12',
|
||||
url: 'https://api.foss42.com/humanize/social',
|
||||
url: 'https://api.apidash.dev/humanize/social',
|
||||
method: HTTPVerb.get,
|
||||
requestParams: [
|
||||
NameValueModel(name: 'num', value: '8700000'),
|
||||
@ -181,21 +181,21 @@ const requestModelGet12 = RequestModel(
|
||||
/// Basic HEAD request model
|
||||
const requestModelHead1 = RequestModel(
|
||||
id: 'head1',
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: HTTPVerb.head,
|
||||
);
|
||||
|
||||
/// Without URI Scheme (pass default as http)
|
||||
const requestModelHead2 = RequestModel(
|
||||
id: 'head2',
|
||||
url: 'api.foss42.com',
|
||||
url: 'api.apidash.dev',
|
||||
method: HTTPVerb.head,
|
||||
);
|
||||
|
||||
/// Basic POST request model (txt body)
|
||||
const requestModelPost1 = RequestModel(
|
||||
id: 'post1',
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: HTTPVerb.post,
|
||||
requestBody: r"""{
|
||||
"text": "I LOVE Flutter"
|
||||
@ -205,7 +205,7 @@ const requestModelPost1 = RequestModel(
|
||||
/// POST request model with JSON body
|
||||
const requestModelPost2 = RequestModel(
|
||||
id: 'post2',
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: HTTPVerb.post,
|
||||
requestBody: r"""{
|
||||
"text": "I LOVE Flutter"
|
||||
@ -215,7 +215,7 @@ const requestModelPost2 = RequestModel(
|
||||
/// POST request model with headers
|
||||
const requestModelPost3 = RequestModel(
|
||||
id: 'post3',
|
||||
url: 'https://api.foss42.com/case/lower',
|
||||
url: 'https://api.apidash.dev/case/lower',
|
||||
method: HTTPVerb.post,
|
||||
requestBody: r"""{
|
||||
"text": "I LOVE Flutter"
|
||||
|
@ -101,7 +101,7 @@ void main() {
|
||||
'request': {
|
||||
'method': 'GET',
|
||||
'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',
|
||||
'queryString': [
|
||||
{'name': 'num', 'value': '8700000', 'comment': ''},
|
||||
@ -162,7 +162,7 @@ void main() {
|
||||
},
|
||||
'request': {
|
||||
'method': 'POST',
|
||||
'url': 'https://api.foss42.com/case/lower',
|
||||
'url': 'https://api.apidash.dev/case/lower',
|
||||
'httpVersion': 'HTTP/1.1',
|
||||
'queryString': [],
|
||||
'headers': [
|
||||
@ -252,7 +252,7 @@ void main() {
|
||||
test('Test requestModelToHARJsonRequest exportMode=true', () {
|
||||
Map<String, dynamic> expectedResult = {
|
||||
'method': 'POST',
|
||||
'url': 'https://api.foss42.com/case/lower',
|
||||
'url': 'https://api.apidash.dev/case/lower',
|
||||
'httpVersion': 'HTTP/1.1',
|
||||
'queryString': [],
|
||||
'headers': [
|
||||
@ -282,7 +282,7 @@ void main() {
|
||||
Map<String, dynamic> expectedResult = {
|
||||
'method': 'GET',
|
||||
'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',
|
||||
'queryString': [
|
||||
{'name': 'num', 'value': '8700000'},
|
||||
@ -301,7 +301,7 @@ void main() {
|
||||
test('Test requestModelToHARJsonRequest useEnabled=true', () {
|
||||
Map<String, dynamic> expectedResult = {
|
||||
'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',
|
||||
'queryString': [
|
||||
{'name': 'num', 'value': '8700000'},
|
||||
|
@ -19,14 +19,14 @@ void main() {
|
||||
});
|
||||
|
||||
test('Testing getRequestTitleFromUrl using url3', () {
|
||||
String url3 = "https://api.foss42.com/country/codes";
|
||||
String title3Expected = "api.foss42.com/country/codes";
|
||||
String url3 = "https://api.apidash.dev/country/codes";
|
||||
String title3Expected = "api.apidash.dev/country/codes";
|
||||
expect(getRequestTitleFromUrl(url3), title3Expected);
|
||||
});
|
||||
|
||||
test('Testing getRequestTitleFromUrl using url4', () {
|
||||
String url4 = "api.foss42.com/country/data";
|
||||
String title4Expected = "api.foss42.com/country/data";
|
||||
String url4 = "api.apidash.dev/country/data";
|
||||
String title4Expected = "api.apidash.dev/country/data";
|
||||
expect(getRequestTitleFromUrl(url4), title4Expected);
|
||||
});
|
||||
|
||||
@ -175,11 +175,11 @@ void main() {
|
||||
|
||||
group("Testing getValidRequestUri", () {
|
||||
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");
|
||||
Uri uri1Expected = Uri(
|
||||
scheme: 'https',
|
||||
host: 'api.foss42.com',
|
||||
host: 'api.apidash.dev',
|
||||
path: 'country/data',
|
||||
queryParameters: {'code': 'US'});
|
||||
expect(getValidRequestUri(url1, [kvRow1]), (uri1Expected, null));
|
||||
@ -193,11 +193,11 @@ void main() {
|
||||
expect(getValidRequestUri("", [kvRow3]), (null, "URL is missing!"));
|
||||
});
|
||||
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");
|
||||
Uri uri4Expected = Uri(
|
||||
scheme: 'https',
|
||||
host: 'api.foss42.com',
|
||||
host: 'api.apidash.dev',
|
||||
path: 'country/data',
|
||||
queryParameters: {'code': 'US'});
|
||||
expect(getValidRequestUri(url4, [kvRow4]), (uri4Expected, null));
|
||||
@ -217,20 +217,20 @@ void main() {
|
||||
});
|
||||
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");
|
||||
Uri uri6Expected = Uri(
|
||||
scheme: 'https',
|
||||
host: 'api.foss42.com',
|
||||
host: 'api.apidash.dev',
|
||||
path: 'country/data',
|
||||
queryParameters: {'code': 'US'});
|
||||
expect(getValidRequestUri(url6, [kvRow6]), (uri6Expected, 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(
|
||||
scheme: 'https',
|
||||
host: 'api.foss42.com',
|
||||
host: 'api.apidash.dev',
|
||||
path: 'country/data',
|
||||
queryParameters: {'code': 'US'});
|
||||
expect(getValidRequestUri(url7, null), (uri7Expected, null));
|
||||
|
@ -17,7 +17,7 @@ void main() {
|
||||
SidebarRequestCard(
|
||||
id: '23',
|
||||
selectedId: '2',
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: HTTPVerb.get,
|
||||
onTap: () {
|
||||
changedValue = 'Single Tapped';
|
||||
@ -34,11 +34,11 @@ void main() {
|
||||
|
||||
expect(find.byType(InkWell), findsOneWidget);
|
||||
|
||||
expect(find.text('api.foss42.com'), findsOneWidget);
|
||||
expect(find.widgetWithText(SizedBox, 'api.foss42.com'), findsOneWidget);
|
||||
expect(find.widgetWithText(Card, 'api.foss42.com'), findsOneWidget);
|
||||
expect(find.text('api.apidash.dev'), findsOneWidget);
|
||||
expect(find.widgetWithText(SizedBox, 'api.apidash.dev'), findsOneWidget);
|
||||
expect(find.widgetWithText(Card, 'api.apidash.dev'), findsOneWidget);
|
||||
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.pumpAndSettle(const Duration(seconds: 2));
|
||||
expect(changedValue, 'Single Tapped');
|
||||
@ -63,7 +63,7 @@ void main() {
|
||||
id: '2',
|
||||
selectedId: '2',
|
||||
editRequestId: '2',
|
||||
url: 'https://api.foss42.com',
|
||||
url: 'https://api.apidash.dev',
|
||||
method: HTTPVerb.get,
|
||||
onTapOutsideNameEditor: () {
|
||||
changedValue = 'Tapped Outside';
|
||||
|
@ -9,7 +9,7 @@ void main() {
|
||||
String code = r'''import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
|
@ -9,7 +9,7 @@ void main() {
|
||||
String code = r'''import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
|
@ -201,7 +201,7 @@ void main() {
|
||||
RequestModel requestModel = const RequestModel(
|
||||
id: '1',
|
||||
method: HTTPVerb.post,
|
||||
url: 'api.foss42.com/case/lower',
|
||||
url: 'api.apidash.dev/case/lower',
|
||||
name: 'foss42 api',
|
||||
requestHeaders: [
|
||||
NameValueModel(name: 'content-length', value: '18'),
|
||||
@ -372,7 +372,7 @@ void main() {
|
||||
String code = r'''import 'package:http/http.dart' as http;
|
||||
|
||||
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);
|
||||
|
||||
|
Reference in New Issue
Block a user