Skip to content

JS: Headers and trailers discarded in unary response #26

Open
@innovate-invent

Description

@innovate-invent

What version of protobuf and what language are you using?
Version: libprotoc 3.12.0
Language: Javascript

What operating system (Linux, Windows, ...) and version?
Manjaro linux

What runtime / compiler are you using (e.g., python version or gcc version)
protoc-gen-grpc-web + protobuf manjaro package

What did you do?
protoc socket.proto --js_out=import_style=commonjs,binary:src/client --ts_out=service=grpc-web:src/client

What did you expect to see
Pass response callback headers and trailers

What did you see instead?

SocketClient.prototype.connect = function connect(requestMessage, metadata, callback) {
  if (arguments.length === 2) {
    callback = arguments[1];
  }
  var client = grpc.unary(Socket.connect, {
    request: requestMessage,
    host: this.serviceHost,
    metadata: metadata,
    transport: this.options.transport,
    debug: this.options.debug,
    onEnd: function (response) {
      if (callback) {
        if (response.status !== grpc.Code.OK) {
          var err = new Error(response.statusMessage);
          err.code = response.status;
          err.metadata = response.trailers;
          callback(err, null);
        } else {
          callback(null, response.message); <-- no headers or trailers
        }
      }
    }
  });
  return {
    cancel: function () {
      callback = null;
      client.close();
    }
  };
};

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions