Skip to content

Commit 62a2ee3

Browse files
committed
Add rawResponse
1 parent a9cffc8 commit 62a2ee3

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

lib/src/client/response/resource_updated.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ class ResourceUpdated {
1616
static Resource? _resource(Map? json) {
1717
if (json != null) {
1818
final doc = InboundDocument(json);
19-
if (doc.hasData) {
20-
return doc.dataAsResource();
21-
}
19+
if (doc.hasData) return doc.dataAsResource();
2220
}
2321
return null;
2422
}

test/unit/client/client_test.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void main() {
2222
await client.fetchCollection('articles');
2323
fail('Exception expected');
2424
} on RequestFailure catch (e) {
25-
expect(e.httpResponse.statusCode, 422);
25+
expect(e.rawResponse.httpResponse.statusCode, 422);
2626
expect(e.errors.first.status, '422');
2727
expect(e.errors.first.title, 'Invalid Attribute');
2828
}
@@ -33,7 +33,7 @@ void main() {
3333
await client.fetchCollection('articles');
3434
fail('Exception expected');
3535
} on RequestFailure catch (e) {
36-
expect(e.httpResponse.statusCode, 500);
36+
expect(e.rawResponse.httpResponse.statusCode, 500);
3737
}
3838
});
3939
});
@@ -558,7 +558,7 @@ void main() {
558558
'articles', '1', 'author', Identifier('people', '42'));
559559
fail('Exception expected');
560560
} on RequestFailure catch (e) {
561-
expect(e.httpResponse.statusCode, 422);
561+
expect(e.rawResponse.httpResponse.statusCode, 422);
562562
expect(e.errors.first.status, '422');
563563
}
564564
});
@@ -615,7 +615,7 @@ void main() {
615615
await client.deleteToOne('articles', '1', 'author');
616616
fail('Exception expected');
617617
} on RequestFailure catch (e) {
618-
expect(e.httpResponse.statusCode, 422);
618+
expect(e.rawResponse.httpResponse.statusCode, 422);
619619
expect(e.errors.first.status, '422');
620620
}
621621
});
@@ -680,7 +680,7 @@ void main() {
680680
.deleteFromMany('articles', '1', 'tags', [Identifier('tags', '1')]);
681681
fail('Exception expected');
682682
} on RequestFailure catch (e) {
683-
expect(e.httpResponse.statusCode, 422);
683+
expect(e.rawResponse.httpResponse.statusCode, 422);
684684
expect(e.errors.first.status, '422');
685685
}
686686
});
@@ -747,7 +747,7 @@ void main() {
747747
.replaceToMany('articles', '1', 'tags', [Identifier('tags', '1')]);
748748
fail('Exception expected');
749749
} on RequestFailure catch (e) {
750-
expect(e.httpResponse.statusCode, 422);
750+
expect(e.rawResponse.httpResponse.statusCode, 422);
751751
expect(e.errors.first.status, '422');
752752
}
753753
});
@@ -814,7 +814,7 @@ void main() {
814814
.addMany('articles', '1', 'tags', [Identifier('tags', '1')]);
815815
fail('Exception expected');
816816
} on RequestFailure catch (e) {
817-
expect(e.httpResponse.statusCode, 422);
817+
expect(e.rawResponse.httpResponse.statusCode, 422);
818818
expect(e.errors.first.status, '422');
819819
expect(e.toString(), contains('422'));
820820
}

0 commit comments

Comments
 (0)