Skip to content

Commit

Permalink
Add rawResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
f3ath committed Aug 30, 2024
1 parent a9cffc8 commit 62a2ee3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions lib/src/client/response/resource_updated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class ResourceUpdated {
static Resource? _resource(Map? json) {
if (json != null) {
final doc = InboundDocument(json);
if (doc.hasData) {
return doc.dataAsResource();
}
if (doc.hasData) return doc.dataAsResource();
}
return null;
}
Expand Down
14 changes: 7 additions & 7 deletions test/unit/client/client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void main() {
await client.fetchCollection('articles');
fail('Exception expected');
} on RequestFailure catch (e) {
expect(e.httpResponse.statusCode, 422);
expect(e.rawResponse.httpResponse.statusCode, 422);
expect(e.errors.first.status, '422');
expect(e.errors.first.title, 'Invalid Attribute');
}
Expand All @@ -33,7 +33,7 @@ void main() {
await client.fetchCollection('articles');
fail('Exception expected');
} on RequestFailure catch (e) {
expect(e.httpResponse.statusCode, 500);
expect(e.rawResponse.httpResponse.statusCode, 500);
}
});
});
Expand Down Expand Up @@ -558,7 +558,7 @@ void main() {
'articles', '1', 'author', Identifier('people', '42'));
fail('Exception expected');
} on RequestFailure catch (e) {
expect(e.httpResponse.statusCode, 422);
expect(e.rawResponse.httpResponse.statusCode, 422);
expect(e.errors.first.status, '422');
}
});
Expand Down Expand Up @@ -615,7 +615,7 @@ void main() {
await client.deleteToOne('articles', '1', 'author');
fail('Exception expected');
} on RequestFailure catch (e) {
expect(e.httpResponse.statusCode, 422);
expect(e.rawResponse.httpResponse.statusCode, 422);
expect(e.errors.first.status, '422');
}
});
Expand Down Expand Up @@ -680,7 +680,7 @@ void main() {
.deleteFromMany('articles', '1', 'tags', [Identifier('tags', '1')]);
fail('Exception expected');
} on RequestFailure catch (e) {
expect(e.httpResponse.statusCode, 422);
expect(e.rawResponse.httpResponse.statusCode, 422);
expect(e.errors.first.status, '422');
}
});
Expand Down Expand Up @@ -747,7 +747,7 @@ void main() {
.replaceToMany('articles', '1', 'tags', [Identifier('tags', '1')]);
fail('Exception expected');
} on RequestFailure catch (e) {
expect(e.httpResponse.statusCode, 422);
expect(e.rawResponse.httpResponse.statusCode, 422);
expect(e.errors.first.status, '422');
}
});
Expand Down Expand Up @@ -814,7 +814,7 @@ void main() {
.addMany('articles', '1', 'tags', [Identifier('tags', '1')]);
fail('Exception expected');
} on RequestFailure catch (e) {
expect(e.httpResponse.statusCode, 422);
expect(e.rawResponse.httpResponse.statusCode, 422);
expect(e.errors.first.status, '422');
expect(e.toString(), contains('422'));
}
Expand Down

0 comments on commit 62a2ee3

Please sign in to comment.