Skip to content

Commit db35f8a

Browse files
committed
Fix dart/flutter tests
1 parent bc27db7 commit db35f8a

File tree

7 files changed

+449
-229
lines changed

7 files changed

+449
-229
lines changed

lib/json_service_client.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class JsonServiceClient implements IServiceClient {
273273
urlFilter(req.uri.toString());
274274
}
275275

276-
HttpClientResponse res = null;
276+
HttpClientResponse res;
277277

278278
resendRequest() async {
279279
req = await createRequest(info);
@@ -351,7 +351,7 @@ class JsonServiceClient implements IServiceClient {
351351
}
352352
if (args != null) url = appendQueryString(url, args);
353353

354-
String bodyStr = null;
354+
String bodyStr;
355355
if (hasRequestBody(method)) {
356356
if (body is String) {
357357
bodyStr = body;
@@ -366,7 +366,7 @@ class JsonServiceClient implements IServiceClient {
366366
req.headers.add(HttpHeaders.AUTHORIZATION, 'Bearer ' + bearerToken);
367367
else if (userName != null)
368368
req.headers.add(HttpHeaders.AUTHORIZATION,
369-
'Basic ' + base64.encode(utf8.encode('${userName}:${password}')));
369+
'Basic ' + base64.encode(utf8.encode('$userName:$password')));
370370

371371
req.cookies.addAll(this.cookies);
372372

@@ -489,6 +489,11 @@ class JsonServiceClient implements IServiceClient {
489489
(res.headers.contentLength == null && !isJson)) {
490490
return responseAs as T;
491491
}
492+
493+
if (res.statusCode == 204 || res.contentLength == 0) { //No Content
494+
return null;
495+
}
496+
492497
return json.decode(await res.transform(utf8.decoder).join());
493498
}
494499

test/dtos/checkweb.dtos.dart

Lines changed: 163 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Options:
2-
Date: 2018-05-01 05:12:23
2+
Date: 2018-08-08 01:56:56
33
Version: 5.00
44
Tip: To override a DTO option, remove "//" prefix before updating
55
BaseUrl: http://localhost:55799
@@ -145,6 +145,25 @@ class Rockstar implements IConvertible
145145
TypeContext context = _ctx;
146146
}
147147

148+
class ArrayElementInDictionary implements IConvertible
149+
{
150+
int id;
151+
152+
ArrayElementInDictionary({this.id});
153+
ArrayElementInDictionary.fromJson(Map<String, dynamic> json) { fromMap(json); }
154+
155+
fromMap(Map<String, dynamic> json) {
156+
id = json['id'];
157+
return this;
158+
}
159+
160+
Map<String, dynamic> toJson() => {
161+
'id': id
162+
};
163+
164+
TypeContext context = _ctx;
165+
}
166+
148167
class ObjectDesign implements IConvertible
149168
{
150169
int id;
@@ -1071,6 +1090,16 @@ class EnumFlags
10711090
static List<EnumFlags> get values => const [Value0,Value1,Value2,Value3,Value123];
10721091
}
10731092

1093+
enum EnumStyle
1094+
{
1095+
lower,
1096+
UPPER,
1097+
PascalCase,
1098+
camelCase,
1099+
camelUPPER,
1100+
PascalUPPER,
1101+
}
1102+
10741103
class Poco implements IConvertible
10751104
{
10761105
String name;
@@ -1795,6 +1824,27 @@ class ChangeRequestResponse implements IConvertible
17951824
TypeContext context = _ctx;
17961825
}
17971826

1827+
class DiscoverTypes implements IReturn<DiscoverTypes>, IConvertible
1828+
{
1829+
Map<String,List<ArrayElementInDictionary>> elementInDictionary;
1830+
1831+
DiscoverTypes({this.elementInDictionary});
1832+
DiscoverTypes.fromJson(Map<String, dynamic> json) { fromMap(json); }
1833+
1834+
fromMap(Map<String, dynamic> json) {
1835+
elementInDictionary = JsonConverters.fromJson(json['elementInDictionary'],'Map<String,List<ArrayElementInDictionary>>',context);
1836+
return this;
1837+
}
1838+
1839+
Map<String, dynamic> toJson() => {
1840+
'elementInDictionary': JsonConverters.toJson(elementInDictionary,'Map<String,List<ArrayElementInDictionary>>',context)
1841+
};
1842+
1843+
createResponse() { return new DiscoverTypes(); }
1844+
String getTypeName() { return "DiscoverTypes"; }
1845+
TypeContext context = _ctx;
1846+
}
1847+
17981848
class CustomHttpErrorResponse implements IConvertible
17991849
{
18001850
String custom;
@@ -2823,7 +2873,7 @@ class HelloAuthenticatedResponse implements IConvertible
28232873
TypeContext context = _ctx;
28242874
}
28252875

2826-
class Echo implements IConvertible
2876+
class Echo implements IEcho, IConvertible
28272877
{
28282878
String sentence;
28292879

@@ -4065,23 +4115,26 @@ class HelloWithEnum implements IConvertible
40654115
EnumWithValues enumWithValues;
40664116
EnumType nullableEnumProp;
40674117
EnumFlags enumFlags;
4118+
EnumStyle enumStyle;
40684119

4069-
HelloWithEnum({this.enumProp,this.enumWithValues,this.nullableEnumProp,this.enumFlags});
4120+
HelloWithEnum({this.enumProp,this.enumWithValues,this.nullableEnumProp,this.enumFlags,this.enumStyle});
40704121
HelloWithEnum.fromJson(Map<String, dynamic> json) { fromMap(json); }
40714122

40724123
fromMap(Map<String, dynamic> json) {
40734124
enumProp = JsonConverters.fromJson(json['enumProp'],'EnumType',context);
40744125
enumWithValues = JsonConverters.fromJson(json['enumWithValues'],'EnumWithValues',context);
40754126
nullableEnumProp = JsonConverters.fromJson(json['nullableEnumProp'],'EnumType',context);
40764127
enumFlags = JsonConverters.fromJson(json['enumFlags'],'EnumFlags',context);
4128+
enumStyle = JsonConverters.fromJson(json['enumStyle'],'EnumStyle',context);
40774129
return this;
40784130
}
40794131

40804132
Map<String, dynamic> toJson() => {
40814133
'enumProp': JsonConverters.toJson(enumProp,'EnumType',context),
40824134
'enumWithValues': JsonConverters.toJson(enumWithValues,'EnumWithValues',context),
40834135
'nullableEnumProp': JsonConverters.toJson(nullableEnumProp,'EnumType',context),
4084-
'enumFlags': JsonConverters.toJson(enumFlags,'EnumFlags',context)
4136+
'enumFlags': JsonConverters.toJson(enumFlags,'EnumFlags',context),
4137+
'enumStyle': JsonConverters.toJson(enumStyle,'EnumStyle',context)
40854138
};
40864139

40874140
TypeContext context = _ctx;
@@ -5305,6 +5358,29 @@ class SwaggerVersionTest implements IConvertible
53055358
TypeContext context = _ctx;
53065359
}
53075360

5361+
// @Route("/swagger/range")
5362+
class SwaggerRangeTest implements IConvertible
5363+
{
5364+
String intRange;
5365+
String doubleRange;
5366+
5367+
SwaggerRangeTest({this.intRange,this.doubleRange});
5368+
SwaggerRangeTest.fromJson(Map<String, dynamic> json) { fromMap(json); }
5369+
5370+
fromMap(Map<String, dynamic> json) {
5371+
intRange = json['intRange'];
5372+
doubleRange = json['doubleRange'];
5373+
return this;
5374+
}
5375+
5376+
Map<String, dynamic> toJson() => {
5377+
'intRange': intRange,
5378+
'doubleRange': doubleRange
5379+
};
5380+
5381+
TypeContext context = _ctx;
5382+
}
5383+
53085384
// @Route("/test/errorview")
53095385
class TestErrorView implements IConvertible
53105386
{
@@ -5536,6 +5612,52 @@ class MatchLang implements IReturn<HelloResponse>, IConvertible
55365612
TypeContext context = _ctx;
55375613
}
55385614

5615+
// @Route("/reqlogstest/{Name}")
5616+
class RequestLogsTest implements IReturn<String>, IConvertible
5617+
{
5618+
String name;
5619+
5620+
RequestLogsTest({this.name});
5621+
RequestLogsTest.fromJson(Map<String, dynamic> json) { fromMap(json); }
5622+
5623+
fromMap(Map<String, dynamic> json) {
5624+
name = json['name'];
5625+
return this;
5626+
}
5627+
5628+
Map<String, dynamic> toJson() => {
5629+
'name': name
5630+
};
5631+
5632+
createResponse() { return ""; }
5633+
String getTypeName() { return "RequestLogsTest"; }
5634+
TypeContext context = _ctx;
5635+
}
5636+
5637+
class InProcRequest1 implements IConvertible
5638+
{
5639+
InProcRequest1();
5640+
InProcRequest1.fromJson(Map<String, dynamic> json) : super();
5641+
fromMap(Map<String, dynamic> json) {
5642+
return this;
5643+
}
5644+
5645+
Map<String, dynamic> toJson() => {};
5646+
TypeContext context = _ctx;
5647+
}
5648+
5649+
class InProcRequest2 implements IConvertible
5650+
{
5651+
InProcRequest2();
5652+
InProcRequest2.fromJson(Map<String, dynamic> json) : super();
5653+
fromMap(Map<String, dynamic> json) {
5654+
return this;
5655+
}
5656+
5657+
Map<String, dynamic> toJson() => {};
5658+
TypeContext context = _ctx;
5659+
}
5660+
55395661
/**
55405662
* SwaggerTest Service Description
55415663
*/
@@ -5795,6 +5917,32 @@ class SwaggerMultiApiResponseTest implements IReturnVoid, IConvertible
57955917
TypeContext context = _ctx;
57965918
}
57975919

5920+
// @Route("/defaultview/class")
5921+
class DefaultViewAttr implements IConvertible
5922+
{
5923+
DefaultViewAttr();
5924+
DefaultViewAttr.fromJson(Map<String, dynamic> json) : super();
5925+
fromMap(Map<String, dynamic> json) {
5926+
return this;
5927+
}
5928+
5929+
Map<String, dynamic> toJson() => {};
5930+
TypeContext context = _ctx;
5931+
}
5932+
5933+
// @Route("/defaultview/action")
5934+
class DefaultViewActionAttr implements IConvertible
5935+
{
5936+
DefaultViewActionAttr();
5937+
DefaultViewActionAttr.fromJson(Map<String, dynamic> json) : super();
5938+
fromMap(Map<String, dynamic> json) {
5939+
return this;
5940+
}
5941+
5942+
Map<String, dynamic> toJson() => {};
5943+
TypeContext context = _ctx;
5944+
}
5945+
57985946
// @Route("/dynamically/registered/{Name}")
57995947
class DynamicallyRegistered implements IConvertible
58005948
{
@@ -6454,6 +6602,7 @@ class QueryDataRockstars extends QueryData<Rockstar> implements IReturn<QueryRes
64546602
TypeContext _ctx = new TypeContext(library: 'localhost', types: <String, TypeInfo> {
64556603
'RequestLogEntry': new TypeInfo(TypeOf.Class, create:() => new RequestLogEntry()),
64566604
'Rockstar': new TypeInfo(TypeOf.Class, create:() => new Rockstar()),
6605+
'ArrayElementInDictionary': new TypeInfo(TypeOf.Class, create:() => new ArrayElementInDictionary()),
64576606
'ObjectDesign': new TypeInfo(TypeOf.Class, create:() => new ObjectDesign()),
64586607
'IAuthTokens': new TypeInfo(TypeOf.Interface),
64596608
'AuthUserSession': new TypeInfo(TypeOf.Class, create:() => new AuthUserSession()),
@@ -6488,6 +6637,7 @@ TypeContext _ctx = new TypeContext(library: 'localhost', types: <String, TypeInf
64886637
'EnumType': new TypeInfo(TypeOf.Enum, enumValues:EnumType.values),
64896638
'EnumWithValues': new TypeInfo(TypeOf.Enum, enumValues:EnumWithValues.values),
64906639
'EnumFlags': new TypeInfo(TypeOf.Enum, enumValues:EnumFlags.values),
6640+
'EnumStyle': new TypeInfo(TypeOf.Enum, enumValues:EnumStyle.values),
64916641
'Poco': new TypeInfo(TypeOf.Class, create:() => new Poco()),
64926642
'AllCollectionTypes': new TypeInfo(TypeOf.Class, create:() => new AllCollectionTypes()),
64936643
'List<Poco>': new TypeInfo(TypeOf.Class, create:() => new List<Poco>()),
@@ -6535,6 +6685,9 @@ TypeContext _ctx = new TypeContext(library: 'localhost', types: <String, TypeInf
65356685
'OnlyDefinedInGenericTypeInto': new TypeInfo(TypeOf.Class, create:() => new OnlyDefinedInGenericTypeInto()),
65366686
'TypesGroup': new TypeInfo(TypeOf.Class, create:() => new TypesGroup()),
65376687
'ChangeRequestResponse': new TypeInfo(TypeOf.Class, create:() => new ChangeRequestResponse()),
6688+
'DiscoverTypes': new TypeInfo(TypeOf.Class, create:() => new DiscoverTypes()),
6689+
'Map<String,List<ArrayElementInDictionary>>': new TypeInfo(TypeOf.Class, create:() => new Map<String,List<ArrayElementInDictionary>>()),
6690+
'List<ArrayElementInDictionary>': new TypeInfo(TypeOf.Class, create:() => new List<ArrayElementInDictionary>()),
65386691
'CustomHttpErrorResponse': new TypeInfo(TypeOf.Class, create:() => new CustomHttpErrorResponse()),
65396692
'AlwaysThrows': new TypeInfo(TypeOf.Class, create:() => new AlwaysThrows()),
65406693
'AlwaysThrowsFilterAttribute': new TypeInfo(TypeOf.Class, create:() => new AlwaysThrowsFilterAttribute()),
@@ -6700,6 +6853,7 @@ TypeContext _ctx = new TypeContext(library: 'localhost', types: <String, TypeInf
67006853
'MatchesId': new TypeInfo(TypeOf.Class, create:() => new MatchesId()),
67016854
'MatchesSlug': new TypeInfo(TypeOf.Class, create:() => new MatchesSlug()),
67026855
'SwaggerVersionTest': new TypeInfo(TypeOf.Class, create:() => new SwaggerVersionTest()),
6856+
'SwaggerRangeTest': new TypeInfo(TypeOf.Class, create:() => new SwaggerRangeTest()),
67036857
'TestErrorView': new TypeInfo(TypeOf.Class, create:() => new TestErrorView()),
67046858
'GetTimestamp': new TypeInfo(TypeOf.Class, create:() => new GetTimestamp()),
67056859
'TestMiniverView': new TypeInfo(TypeOf.Class, create:() => new TestMiniverView()),
@@ -6712,12 +6866,17 @@ TypeContext _ctx = new TypeContext(library: 'localhost', types: <String, TypeInf
67126866
'DownloadGzipFile': new TypeInfo(TypeOf.Class, create:() => new DownloadGzipFile()),
67136867
'MatchName': new TypeInfo(TypeOf.Class, create:() => new MatchName()),
67146868
'MatchLang': new TypeInfo(TypeOf.Class, create:() => new MatchLang()),
6869+
'RequestLogsTest': new TypeInfo(TypeOf.Class, create:() => new RequestLogsTest()),
6870+
'InProcRequest1': new TypeInfo(TypeOf.Class, create:() => new InProcRequest1()),
6871+
'InProcRequest2': new TypeInfo(TypeOf.Class, create:() => new InProcRequest2()),
67156872
'SwaggerTest': new TypeInfo(TypeOf.Class, create:() => new SwaggerTest()),
67166873
'SwaggerTest2': new TypeInfo(TypeOf.Class, create:() => new SwaggerTest2()),
67176874
'SwaggerComplex': new TypeInfo(TypeOf.Class, create:() => new SwaggerComplex()),
67186875
'SwaggerPostTest': new TypeInfo(TypeOf.Class, create:() => new SwaggerPostTest()),
67196876
'SwaggerPostTest2': new TypeInfo(TypeOf.Class, create:() => new SwaggerPostTest2()),
67206877
'SwaggerMultiApiResponseTest': new TypeInfo(TypeOf.Class, create:() => new SwaggerMultiApiResponseTest()),
6878+
'DefaultViewAttr': new TypeInfo(TypeOf.Class, create:() => new DefaultViewAttr()),
6879+
'DefaultViewActionAttr': new TypeInfo(TypeOf.Class, create:() => new DefaultViewActionAttr()),
67216880
'DynamicallyRegistered': new TypeInfo(TypeOf.Class, create:() => new DynamicallyRegistered()),
67226881
'QueryPostgresRockstars': new TypeInfo(TypeOf.Class, create:() => new QueryPostgresRockstars()),
67236882
'QueryPostgresPgRockstars': new TypeInfo(TypeOf.Class, create:() => new QueryPostgresPgRockstars()),

0 commit comments

Comments
 (0)