mirror of https://github.com/grpc/grpc-dart.git
feat: make default options platform aware
This commit is contained in:
parent
d297a29cb7
commit
a6f6e986ea
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) 2018, the gRPC project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
export 'call_options_grpc.dart'
|
||||
if (dart.library.js_interop) 'call_options_grpcweb.dart';
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2018, the gRPC project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import '../../../grpc.dart';
|
||||
|
||||
///
|
||||
/// Call options for gRPC.
|
||||
///
|
||||
CallOptions callOptions() {
|
||||
return CallOptions();
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2018, the gRPC project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import '../../../grpc_web.dart';
|
||||
|
||||
///
|
||||
/// Call options for gRPC-web.
|
||||
///
|
||||
CallOptions callOptions() {
|
||||
return WebCallOptions(withCredentials: true);
|
||||
}
|
|
@ -14,6 +14,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import 'call.dart';
|
||||
import 'call_options/call_options.dart';
|
||||
import 'channel.dart';
|
||||
import 'common.dart';
|
||||
import 'interceptor.dart';
|
||||
|
@ -28,7 +29,7 @@ class Client {
|
|||
/// Interceptors will be applied in direct order before making a request.
|
||||
Client(this._channel,
|
||||
{CallOptions? options, Iterable<ClientInterceptor>? interceptors})
|
||||
: _options = options ?? CallOptions(),
|
||||
: _options = options ?? callOptions(),
|
||||
_interceptors = List.unmodifiable(interceptors ?? Iterable.empty());
|
||||
|
||||
@Deprecated(r'''This method does not invoke interceptors and is superseded
|
||||
|
|
Loading…
Reference in New Issue