Skip to content

Commit 24fc36b

Browse files
committed
Add rawResponse
1 parent a07ef8e commit 24fc36b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/src/client/response/request_failure.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ class RequestFailure implements Exception {
2727

2828
@override
2929
String toString() =>
30-
'JSON:API request failed with HTTP status ${httpResponse.statusCode}.';
30+
'JSON:API request failed with HTTP status ${rawResponse.httpResponse.statusCode}.';
3131
}

test/contract/crud_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void main() {
4747
Include(['author', 'comments', 'comments.author'])
4848
]);
4949

50-
expect(response.httpResponse.statusCode, 200);
50+
expect(response.rawResponse.httpResponse.statusCode, 200);
5151
expect(response.collection.length, 1);
5252
expect(response.included.length, 3);
5353

@@ -175,7 +175,7 @@ void main() {
175175
await action();
176176
fail('Exception expected');
177177
} on RequestFailure catch (e) {
178-
expect(e.httpResponse.statusCode, 404);
178+
expect(e.rawResponse.httpResponse.statusCode, 404);
179179
}
180180
}
181181
});

test/contract/resource_creation_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ void main() {
1616
test('Resource id assigned on the server', () async {
1717
await client
1818
.createNew('posts', attributes: {'title': 'Hello world'}).then((r) {
19-
expect(r.httpResponse.statusCode, 201);
20-
expect(r.httpResponse.headers['location'], ['/posts/${r.resource.id}']);
19+
expect(r.rawResponse.httpResponse.statusCode, 201);
20+
expect(r.rawResponse.httpResponse.headers['location'], ['/posts/${r.resource.id}']);
2121
expect(r.links['self'].toString(), '/posts/${r.resource.id}');
2222
expect(r.resource.type, 'posts');
2323
expect(r.resource.attributes['title'], 'Hello world');
@@ -30,8 +30,8 @@ void main() {
3030
lid: 'lid',
3131
attributes: {'title': 'Hello world'},
3232
one: {'self': LocalIdentifier('posts', 'lid')}).then((r) {
33-
expect(r.httpResponse.statusCode, 201);
34-
expect(r.httpResponse.headers['location'], ['/posts/${r.resource.id}']);
33+
expect(r.rawResponse.httpResponse.statusCode, 201);
34+
expect(r.rawResponse.httpResponse.headers['location'], ['/posts/${r.resource.id}']);
3535
expect(r.links['self'].toString(), '/posts/${r.resource.id}');
3636
expect(r.resource.type, 'posts');
3737
expect(r.resource.attributes['title'], 'Hello world');
@@ -42,9 +42,9 @@ void main() {
4242
test('Resource id assigned on the client', () async {
4343
await client.create('posts', '12345',
4444
attributes: {'title': 'Hello world'}).then((r) {
45-
expect(r.httpResponse.statusCode, 204);
45+
expect(r.rawResponse.httpResponse.statusCode, 204);
4646
expect(r.resource, isNull);
47-
expect(r.httpResponse.headers['location'], isNull);
47+
expect(r.rawResponse.httpResponse.headers['location'], isNull);
4848
});
4949
});
5050
});

0 commit comments

Comments
 (0)