mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 05:32:26 +08:00
all test cases has been updated regarding dart dio
This commit is contained in:
@ -12,10 +12,10 @@ void main() {
|
||||
|
||||
void main() async {
|
||||
try {
|
||||
final response = await dio.Dio.get('https://api.apidash.dev');
|
||||
final response = await dio.Dio().get('https://api.apidash.dev');
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -36,13 +36,13 @@ void main() async {
|
||||
void main() async {
|
||||
try {
|
||||
final queryParams = {'code': 'US'};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.apidash.dev/country/data',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -63,13 +63,13 @@ void main() async {
|
||||
void main() async {
|
||||
try {
|
||||
final queryParams = {'code': 'IND'};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.apidash.dev/country/data?code=US',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -96,13 +96,13 @@ void main() async {
|
||||
'add_space': 'true',
|
||||
'trailing_zeros': 'true',
|
||||
};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.apidash.dev/humanize/social',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -123,13 +123,13 @@ void main() async {
|
||||
void main() async {
|
||||
try {
|
||||
final headers = {'User-Agent': 'Test Agent'};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.github.com/repos/foss42/apidash',
|
||||
options: Options(headers: headers),
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -151,14 +151,14 @@ void main() async {
|
||||
try {
|
||||
final queryParams = {'raw': 'true'};
|
||||
final headers = {'User-Agent': 'Test Agent'};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.github.com/repos/foss42/apidash',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -178,10 +178,10 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
try {
|
||||
final response = await dio.Dio.get('https://api.apidash.dev');
|
||||
final response = await dio.Dio().get('https://api.apidash.dev');
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -203,14 +203,14 @@ void main() async {
|
||||
try {
|
||||
final queryParams = {'raw': 'true'};
|
||||
final headers = {'User-Agent': 'Test Agent'};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.github.com/repos/foss42/apidash',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -234,13 +234,13 @@ void main() async {
|
||||
'num': '8700000',
|
||||
'add_space': 'true',
|
||||
};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.apidash.dev/humanize/social',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -261,13 +261,13 @@ void main() async {
|
||||
void main() async {
|
||||
try {
|
||||
final headers = {'User-Agent': 'Test Agent'};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.apidash.dev/humanize/social',
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -296,14 +296,14 @@ void main() async {
|
||||
'digits': '3',
|
||||
};
|
||||
final headers = {'User-Agent': 'Test Agent'};
|
||||
final response = await dio.Dio.get(
|
||||
final response = await dio.Dio().get(
|
||||
'https://api.apidash.dev/humanize/social',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -323,10 +323,10 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
try {
|
||||
final response = await dio.Dio.get('https://api.apidash.dev/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) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -348,10 +348,10 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
try {
|
||||
final response = await dio.Dio.head('https://api.apidash.dev');
|
||||
final response = await dio.Dio().head('https://api.apidash.dev');
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -371,10 +371,10 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
try {
|
||||
final response = await dio.Dio.head('http://api.apidash.dev');
|
||||
final response = await dio.Dio().head('http://api.apidash.dev');
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -399,13 +399,13 @@ void main() async {
|
||||
final data = r'''{
|
||||
"text": "I LOVE Flutter"
|
||||
}''';
|
||||
final response = await dio.Dio.post(
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/case/lower',
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -434,13 +434,13 @@ void main() async {
|
||||
"no": 1.2,
|
||||
"arr": ["null", "true", "false", null]
|
||||
}''');
|
||||
final response = await dio.Dio.post(
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/case/lower',
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -465,14 +465,14 @@ void main() async {
|
||||
final data = convert.json.decode(r'''{
|
||||
"text": "I LOVE Flutter"
|
||||
}''');
|
||||
final response = await dio.Dio.post(
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/case/lower',
|
||||
options: Options(headers: headers),
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -517,12 +517,12 @@ void main() async {
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/io/form',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -573,12 +573,12 @@ void main() async {
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/io/form',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -629,12 +629,12 @@ void main() async {
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/io/img',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -685,12 +685,12 @@ void main() async {
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/io/img',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -741,12 +741,12 @@ void main() async {
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/io/form',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -801,12 +801,12 @@ void main() async {
|
||||
final response = await dio.Dio().post(
|
||||
'https://api.apidash.dev/io/img',
|
||||
queryParameters: queryParams,
|
||||
options: Options(headers: headers),
|
||||
options: dio.Options(headers: headers),
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -833,13 +833,13 @@ void main() async {
|
||||
"name": "morpheus",
|
||||
"job": "zion resident"
|
||||
}''');
|
||||
final response = await dio.Dio.put(
|
||||
final response = await dio.Dio().put(
|
||||
'https://reqres.in/api/users/2',
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -866,13 +866,13 @@ void main() async {
|
||||
"name": "marfeus",
|
||||
"job": "accountant"
|
||||
}''');
|
||||
final response = await dio.Dio.patch(
|
||||
final response = await dio.Dio().patch(
|
||||
'https://reqres.in/api/users/2',
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -894,10 +894,10 @@ void main() async {
|
||||
|
||||
void main() async {
|
||||
try {
|
||||
final response = await dio.Dio.delete('https://reqres.in/api/users/2');
|
||||
final response = await dio.Dio().delete('https://reqres.in/api/users/2');
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
@ -923,13 +923,13 @@ void main() async {
|
||||
"name": "marfeus",
|
||||
"job": "accountant"
|
||||
}''');
|
||||
final response = await dio.Dio.delete(
|
||||
final response = await dio.Dio().delete(
|
||||
'https://reqres.in/api/users/2',
|
||||
data: data,
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.data);
|
||||
} on DioException catch (e, s) {
|
||||
} on dio.DioException catch (e, s) {
|
||||
print(e.response?.statusCode);
|
||||
print(e.response?.data);
|
||||
print(s);
|
||||
|
Reference in New Issue
Block a user