mirror of https://github.com/grpc/grpc-web.git
Code sync from internal code base
This commit is contained in:
parent
e88fdc809d
commit
3fc20fbaf5
|
@ -28,7 +28,7 @@ goog.module.declareLegacyNamespace();
|
|||
|
||||
|
||||
const ClientReadableStream = goog.require('grpc.web.ClientReadableStream');
|
||||
const Error = goog.require('grpc.web.Error');
|
||||
const GrpcWebError = goog.require('grpc.web.Error');
|
||||
const MethodDescriptor = goog.require('grpc.web.MethodDescriptor');
|
||||
const MethodType = goog.require('grpc.web.MethodType');
|
||||
|
||||
|
@ -49,7 +49,7 @@ const AbstractClientBase = class {
|
|||
* @param {!MethodDescriptor<REQUEST, RESPONSE>|
|
||||
* !AbstractClientBase.MethodInfo<REQUEST, RESPONSE>}
|
||||
* methodDescriptor Information of this RPC method
|
||||
* @param {function(?Error, ?)}
|
||||
* @param {function(?GrpcWebError, ?)}
|
||||
* callback A callback function which takes (error, RESPONSE or null)
|
||||
* @return {!ClientReadableStream<RESPONSE>}
|
||||
*/
|
||||
|
@ -65,7 +65,7 @@ const AbstractClientBase = class {
|
|||
* @param {!MethodDescriptor<REQUEST, RESPONSE>|
|
||||
* !AbstractClientBase.MethodInfo<REQUEST,RESPONSE>}
|
||||
* methodDescriptor Information of this RPC method
|
||||
* @return {!IThenable <!RESPONSE>}
|
||||
* @return {!IThenable<RESPONSE>}
|
||||
* A promise that resolves to the response message
|
||||
*/
|
||||
thenableCall(method, requestMessage, metadata, methodDescriptor) {}
|
||||
|
|
|
@ -582,7 +582,7 @@ void PrintCommonJsMessagesDeps(Printer* printer, const FileDescriptor* file) {
|
|||
printer->Print(vars, "proto.$current_package_ns$ = {};\n");
|
||||
|
||||
offset = dotIndex + 1;
|
||||
dotIndex = package.find(".", offset);
|
||||
dotIndex = package.find('.', offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1338,6 +1338,7 @@ void PrintMultipleFilesMode(const FileDescriptor* file, string file_name,
|
|||
GeneratorContext* context,
|
||||
std::map<string, string> vars) {
|
||||
std::map<string, string> method_descriptors;
|
||||
bool has_server_streaming = false;
|
||||
|
||||
// Print MethodDescriptor files.
|
||||
for (int i = 0; i < file->service_count(); ++i) {
|
||||
|
@ -1351,6 +1352,9 @@ void PrintMultipleFilesMode(const FileDescriptor* file, string file_name,
|
|||
string method_file_name = Lowercase(service->name()) + "_" +
|
||||
Lowercase(method->name()) +
|
||||
"_methoddescriptor.js";
|
||||
if (method->server_streaming()) {
|
||||
has_server_streaming = true;
|
||||
}
|
||||
std::unique_ptr<ZeroCopyOutputStream> output(
|
||||
context->Open(method_file_name));
|
||||
Printer printer(output.get(), '$');
|
||||
|
@ -1406,8 +1410,9 @@ void PrintMultipleFilesMode(const FileDescriptor* file, string file_name,
|
|||
printer1.Print(vars, "goog.require('grpc.web.ClientReadableStream');\n");
|
||||
printer1.Print(vars, "goog.require('grpc.web.Error');\n");
|
||||
printer2.Print(vars, "goog.require('grpc.web.$mode$ClientBase');\n");
|
||||
printer2.Print(vars, "goog.require('grpc.web.ClientReadableStream');\n");
|
||||
printer2.Print(vars, "goog.require('grpc.web.Error');\n");
|
||||
if (has_server_streaming) {
|
||||
printer2.Print(vars, "goog.require('grpc.web.ClientReadableStream');\n");
|
||||
}
|
||||
|
||||
PrintClosureDependencies(&printer1, file);
|
||||
PrintClosureDependencies(&printer2, file);
|
||||
|
|
|
@ -222,7 +222,7 @@ class GrpcWebClientBase {
|
|||
* @static
|
||||
* @template RESPONSE
|
||||
* @param {!ClientReadableStream<RESPONSE>} stream
|
||||
* @param {function(?Error, ?RESPONSE, ?Status=, ?Metadata=)|
|
||||
* @param {function(?Error, ?RESPONSE, ?Status=, ?Object<string, string>=)|
|
||||
* function(?Error,?RESPONSE)} callback
|
||||
* @param {boolean} useUnaryResponse
|
||||
*/
|
||||
|
|
|
@ -124,6 +124,14 @@ class GrpcWebStreamParser {
|
|||
return this.errorMessage_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @return {boolean}
|
||||
*/
|
||||
acceptsBinaryInput() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the new input.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue