Skip to content

Commit

Permalink
Remove package:http dependency (flutter#15)
Browse files Browse the repository at this point in the history
* Remove http dependency
  • Loading branch information
grouma authored Oct 14, 2019
1 parent a886dc6 commit 05f2180
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.2

- Remove `package:http` dependency.

## 2.1.1

- Use proper headers delimiter.
Expand Down
9 changes: 4 additions & 5 deletions lib/client/sse_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'dart:async';
import 'dart:convert';
import 'dart:html';

import 'package:http/browser_client.dart';
import 'package:logging/logging.dart';
import 'package:stream_channel/stream_channel.dart';
import 'package:uuid/uuid.dart';
Expand All @@ -20,8 +19,6 @@ class SseClient extends StreamChannelMixin<String> {

final _outgoingController = StreamController<String>();

final _client = BrowserClient()..withCredentials = true;

final _logger = Logger('SseClient');

EventSource _eventSource;
Expand Down Expand Up @@ -62,7 +59,6 @@ class SseClient extends StreamChannelMixin<String> {
_eventSource.close();
_incomingController.close();
_outgoingController.close();
_client.close();
}

void _onIncomingControlMessage(Event message) {
Expand Down Expand Up @@ -93,7 +89,10 @@ class SseClient extends StreamChannelMixin<String> {
void _startPostingMessages() async {
await for (var message in _messages.stream) {
try {
await _client.post(_serverUrl, body: jsonEncode(message));
await HttpRequest.request(_serverUrl,
method: 'POST',
sendData: jsonEncode(message),
withCredentials: true);
} on JsonUnsupportedObjectError catch (e) {
_logger.warning('Unable to encode outgoing message: $e');
} on ArgumentError catch (e) {
Expand Down
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sse
version: 2.1.1
version: 2.1.2
author: Dart Team <[email protected]>
homepage: https://github.com/dart-lang/sse
description: >-
Expand All @@ -12,7 +12,6 @@ environment:

dependencies:
async: ^2.0.8
http: ^0.12.0+1
logging: ^0.11.3+2
pedantic: ^1.4.0
stream_channel: '>=1.6.8 <3.0.0'
Expand Down

0 comments on commit 05f2180

Please sign in to comment.