v.1.0.20 webapi CORS
This commit is contained in:
parent
dbb3b5005d
commit
c41c40a975
67
README.md
67
README.md
@ -1,64 +1,89 @@
|
|||||||
Workout Test and Diet 4 You Common Util Functions
|
Workout Test and Diet 4 You Common Util Functions
|
||||||
|
|
||||||
Version 1.0.19
|
### Version 1.0.20
|
||||||
|
|
||||||
|
webapi CORS
|
||||||
|
|
||||||
|
### Version 1.0.19
|
||||||
|
|
||||||
dotenv logging test
|
dotenv logging test
|
||||||
|
|
||||||
Version 1.0.18
|
### Version 1.0.18
|
||||||
|
|
||||||
debug by dotenv
|
debug by dotenv
|
||||||
|
|
||||||
Version 1.0.17
|
### Version 1.0.17
|
||||||
|
|
||||||
Webapi remove http.get utf8 decode
|
Webapi remove http.get utf8 decode
|
||||||
|
|
||||||
Version 1.0.16
|
### Version 1.0.16
|
||||||
|
|
||||||
Webapi utf8 decode
|
Webapi utf8 decode
|
||||||
|
|
||||||
Version 1.0.15
|
### Version 1.0.15
|
||||||
|
|
||||||
AppText and translations
|
AppText and translations
|
||||||
|
|
||||||
Version 1.0.14
|
### Version 1.0.14
|
||||||
|
|
||||||
OpenAI chat completion extension fix
|
OpenAI chat completion extension fix
|
||||||
|
|
||||||
Version 1.0.13
|
### Version 1.0.13
|
||||||
|
|
||||||
OpenAI chat completion extension
|
OpenAI chat completion extension
|
||||||
|
|
||||||
Version 1.0.12
|
### Version 1.0.12
|
||||||
|
|
||||||
CustomerProperty and CustomerMembership fromJson
|
CustomerProperty and CustomerMembership fromJson
|
||||||
|
|
||||||
Version 1.0.11
|
### Version 1.0.11
|
||||||
|
|
||||||
No FCM on Web
|
No FCM on Web
|
||||||
|
|
||||||
Version 1.0.11
|
### Version 1.0.11
|
||||||
|
|
||||||
Sentry and logging only in debugMode
|
Sentry and logging only in debugMode
|
||||||
|
|
||||||
Version 1.0.10
|
### Version 1.0.10
|
||||||
|
|
||||||
Firebase FCM for web
|
Firebase FCM for web
|
||||||
|
|
||||||
Version 1.0.9
|
### Version 1.0.9
|
||||||
|
|
||||||
Firebase web config
|
Firebase web config
|
||||||
|
|
||||||
Version 1.0.8
|
### Version 1.0.8
|
||||||
|
|
||||||
mombership model error fix
|
mombership model error fix
|
||||||
|
|
||||||
Version 1.0.7
|
### Version 1.0.7
|
||||||
|
|
||||||
openai with model name and temperature
|
openai with model name and temperature
|
||||||
|
|
||||||
Version 1.0.6
|
### Version 1.0.6
|
||||||
|
|
||||||
membership, customer_membership
|
membership, customer_membership
|
||||||
|
|
||||||
Version 1.0.5
|
### Version 1.0.5
|
||||||
|
|
||||||
number picker widget
|
number picker widget
|
||||||
|
|
||||||
Version 1.0.4
|
### Version 1.0.4
|
||||||
|
|
||||||
webapi client fixes
|
webapi client fixes
|
||||||
|
|
||||||
Version 1.0.3
|
### Version 1.0.3
|
||||||
|
|
||||||
Warning fixes, webapi client
|
Warning fixes, webapi client
|
||||||
|
|
||||||
Version 1.0.2
|
### Version 1.0.2
|
||||||
|
|
||||||
Open AI API support
|
Open AI API support
|
||||||
|
|
||||||
Version 1.0.1
|
### Version 1.0.1
|
||||||
|
|
||||||
changes from aitrainer_app 1.1.29 working copy
|
changes from aitrainer_app 1.1.29 working copy
|
||||||
|
|
||||||
Version 1.0.0
|
### Version 1.0.0
|
||||||
|
|
||||||
outsourced from aitrainer_app 1.1.28
|
outsourced from aitrainer_app 1.1.28
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
dotenv=1
|
dotenv=1
|
||||||
debug=2
|
debug=1
|
@ -27,6 +27,7 @@ class APIWebClient with Common, Logging {
|
|||||||
final body = jsonEncode(<String, String>{'username': email, 'password': password});
|
final body = jsonEncode(<String, String>{'username': email, 'password': password});
|
||||||
var uri = Uri.parse(url);
|
var uri = Uri.parse(url);
|
||||||
var result = await http.post(uri, body: body, headers: {
|
var result = await http.post(uri, body: body, headers: {
|
||||||
|
"Access-Control-Allow-Origin": 'https://*.diet4you.eu, https://*.diet4you.hu',
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": "1",
|
"Authorization": "1",
|
||||||
});
|
});
|
||||||
@ -64,6 +65,7 @@ class APIWebClient with Common, Logging {
|
|||||||
}
|
}
|
||||||
var uri = Uri.parse(url);
|
var uri = Uri.parse(url);
|
||||||
var result = await http.post(uri, body: body, headers: {
|
var result = await http.post(uri, body: body, headers: {
|
||||||
|
"Access-Control-Allow-Origin": 'https://*.diet4you.eu, https://*.diet4you.hu',
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": 'Bearer $authToken',
|
"Authorization": 'Bearer $authToken',
|
||||||
});
|
});
|
||||||
@ -97,7 +99,7 @@ class APIWebClient with Common, Logging {
|
|||||||
var uri = Uri.parse(url);
|
var uri = Uri.parse(url);
|
||||||
var result = await http.get(uri, headers: {
|
var result = await http.get(uri, headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
//"Accept-Charset": 'utf-8',
|
"Access-Control-Allow-Origin": 'https://*.diet4you.eu, https://*.diet4you.hu',
|
||||||
"Authorization": 'Bearer $authToken',
|
"Authorization": 'Bearer $authToken',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: workouttest_util
|
name: workouttest_util
|
||||||
description: Workout Test app and web functions.
|
description: Workout Test app and web functions.
|
||||||
version: 1.0.19
|
version: 1.0.20
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.6 <3.0.0"
|
sdk: ">=2.18.6 <3.0.0"
|
||||||
|
44
test/webapi_test.dart
Normal file
44
test/webapi_test.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:workouttest_util/model/cache.dart';
|
||||||
|
import 'package:workouttest_util/service/webapi.dart';
|
||||||
|
import 'package:workouttest_util/util/logging.dart';
|
||||||
|
|
||||||
|
class LoggingTest with Logging {}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
late LoggingTest mockLogging;
|
||||||
|
setUp(() async {
|
||||||
|
mockLogging = LoggingTest();
|
||||||
|
await dotenv.load(fileName: "assets/.env");
|
||||||
|
Cache().setDietTestBaseUrl();
|
||||||
|
});
|
||||||
|
|
||||||
|
group('api', () {
|
||||||
|
test('connect webapi auth successfully', () async {
|
||||||
|
var api = APIWebClient();
|
||||||
|
var responseJson = await api.authenticateUser("bosi", "andio2009");
|
||||||
|
print(responseJson);
|
||||||
|
Cache().authToken = responseJson['token'];
|
||||||
|
final body = await api.get("customers/72", "");
|
||||||
|
print(body);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('test customer conversation in utf8', () async {
|
||||||
|
var api = APIWebClient();
|
||||||
|
var responseJson = await api.authenticateUser("bosi", "andio2009");
|
||||||
|
print(responseJson);
|
||||||
|
Cache().authToken = responseJson['token'];
|
||||||
|
final body = await api.get("customer_conversation/72", "");
|
||||||
|
|
||||||
|
List<int> bytes3 = base64.decode(body);
|
||||||
|
String decodedString = utf8.decode(bytes3);
|
||||||
|
print(decodedString);
|
||||||
|
|
||||||
|
final body2 = await api.get("meal/21", "");
|
||||||
|
print(body2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user