Skip to content

Commit

Permalink
Merge pull request #83 from fsw/httprequest-load-fix
Browse files Browse the repository at this point in the history
HttpRequest load fix
  • Loading branch information
terrier989 authored Sep 10, 2023
2 parents 33d2dbe + 69841d6 commit 73798c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/html/api/http_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ class HttpRequest extends HttpRequestEventTarget {

// Set response data
_responseData = Uint8List.fromList(buffer);
dispatchEvent(ProgressEvent('load'));
} catch (error) {
dispatchEvent(ProgressEvent('error'));
} finally {
Expand Down
5 changes: 5 additions & 0 deletions test/src/html/api/networking_http_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ void _testHttpRequest() {
expect(onTimeout.eventsDispatched, 0);
}, timeout: Timeout(Duration(seconds: 5)));

test('GET, using getString', () async {
String testResponse = await HttpRequest.getString('http://localhost:$_httpServerPort/http_request/ok');
expect(testResponse, 'hello');
}, timeout: Timeout(Duration(seconds: 5)));

test('Failing request', () async {
//
// Declare HttpRequest
Expand Down

0 comments on commit 73798c3

Please sign in to comment.