File tree Expand file tree Collapse file tree 3 files changed +19
-7
lines changed Expand file tree Collapse file tree 3 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 1
1
## 4.1.0
2
- * Add a ` serverInterceptors ` argument to ` ConnectionServer ` . These interceptors are acting
2
+ * Add a ` serverInterceptors ` argument to ` ConnectionServer ` . These interceptors are acting
3
3
as middleware, wrapping a ` ServiceMethod ` invocation.
4
+ * Make sure that ` CallOptions.mergeWith ` is symmetric: given ` WebCallOptions `
5
+ it should return ` WebCallOptions ` .
4
6
5
7
## 4.0.4
6
8
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ class CallOptions {
86
86
87
87
CallOptions mergedWith (CallOptions ? other) {
88
88
if (other == null ) return this ;
89
+
90
+ if (other is WebCallOptions ) {
91
+ return other.mergedWith (this );
92
+ }
93
+
89
94
final mergedMetadata = Map .of (metadata)..addAll (other.metadata);
90
95
final mergedTimeout = other.timeout ?? timeout;
91
96
final mergedProviders = List .of (metadataProviders)
Original file line number Diff line number Diff line change @@ -34,15 +34,20 @@ void main() {
34
34
});
35
35
36
36
test ('WebCallOptions mergeWith CallOptions returns WebCallOptions' , () {
37
- final options =
37
+ final options1 =
38
38
WebCallOptions (bypassCorsPreflight: true , withCredentials: true );
39
39
final metadata = {'test' : '42' };
40
- final mergedOptions =
41
- options.mergedWith (CallOptions (metadata: metadata)) as WebCallOptions ;
40
+ final options2 = CallOptions (metadata: metadata);
41
+ final mergedOptions1 = options1.mergedWith (options2) as WebCallOptions ;
42
+ final mergedOptions2 = options2.mergedWith (options1) as WebCallOptions ;
42
43
43
- expect (mergedOptions.metadata, metadata);
44
- expect (mergedOptions.bypassCorsPreflight, true );
45
- expect (mergedOptions.withCredentials, true );
44
+ expect (mergedOptions1.metadata, metadata);
45
+ expect (mergedOptions1.bypassCorsPreflight, true );
46
+ expect (mergedOptions1.withCredentials, true );
47
+
48
+ expect (mergedOptions2.metadata, metadata);
49
+ expect (mergedOptions2.bypassCorsPreflight, true );
50
+ expect (mergedOptions2.withCredentials, true );
46
51
});
47
52
48
53
test (
You can’t perform that action at this time.
0 commit comments