protocolbuffers / protocolbuffers/protobuf-javascript

JS: Headers and trailers discarded in unary response

Open
#26 0 comments 0 reactions 1 assignee View on GitHub

@lukesandberg is already working on this.

Since Aug 26, 2021.

javascript triaged
Dominant language
JavaScript
Stars
471
Forks
91
Avg merge
3h 57m
Merged PRs (30d)
2

Description

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();
    }
  };
};

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.