Skip to content

Commit 53e9ace

Browse files
authored
Issue 206 fix (#207)
1 parent 3a59ba8 commit 53e9ace

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/src/coap_observe_client_relation.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import 'dart:async';
99

10+
import 'package:coap/src/option/coap_option_type.dart';
1011
import 'package:collection/collection.dart';
1112
import 'package:meta/meta.dart';
1213

@@ -66,8 +67,14 @@ class CoapObserveClientRelation extends Stream<CoapResponse> {
6667
@internal
6768
CoapRequest cancellation() =>
6869
CoapRequest.get(_request.uri)
69-
// Copy options, but set Observe to cancel
70-
..setOptions(_request.getAllOptions())
70+
// Copy options except for URI host and Path, but set Observe to cancel
71+
..setOptions(
72+
_request.getAllOptions().skipWhile(
73+
(option) =>
74+
option.type == OptionType.uriHost ||
75+
option.type == OptionType.uriPath,
76+
),
77+
)
7178
..observe = ObserveRegistration.deregister.value
7279
// Use same Token
7380
..token = _request.token

0 commit comments

Comments
 (0)