Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question|Feature: Sending Binary Metadata #72

Closed
nevi-me opened this issue Mar 24, 2018 · 7 comments
Closed

Question|Feature: Sending Binary Metadata #72

nevi-me opened this issue Mar 24, 2018 · 7 comments

Comments

@nevi-me
Copy link

@nevi-me nevi-me commented Mar 24, 2018

The grpc spec allows for sending metadata-bin as binary metadata. Is this currently supported?

v0.4.0

Repro steps

  1. Create a grpc-dart client to connect to a server

  2. Create a client call including a binary metadata key with a text value

    channel.stub.myMethod(new Request(), options: new CallOptions(metadata: {
      "testmetadata": "a string",
      "testmetadata-bin": "supposed to be binary"
    }, timeout: new Duration(seconds: 15))).then((Response response) {
      print(response);
    }).catchError((GrpcError error) {
      print("******* ${error.message} ******");
    });

Expected result: The request should either throw an error about malformed *-bin metadata, or discard the metadata

Actual result: The request sends the metadata, but there's a failure on the server (tested with NodeJS and Java)

Details

The request seems to silently fail on both NodeJS and Java, I tried getting log output, but couldn't find anything. I use nghttpx as my proxy, and it passed the testmetadata-bin as I supplied it.

One of the reasons why I use binary metadata is to pass my custom error messages as protobuf messages. I suppose it's a question for another day, but how would I deal with bytedata in dart? Do I use Uint8List?

@nevi-me
Copy link
Author

@nevi-me nevi-me commented Mar 24, 2018

I forgot to mention, removing the binary metadata field results in a successful call.

As a side note, flutter with gRPC is a dream so far! I'm rewriting an Android app that I gave up on after over a month, and within 2 days, I'm about 70% done with the same spec app using Flutter!

@jakobr-google
Copy link
Contributor

@jakobr-google jakobr-google commented Apr 6, 2018

Byte data in Dart is a Uint8List, yes.

There's currently no special support for binary metadata, so with the current code, you'll need to base64-encode the data yourself. Something like:

metadata: { 'testmetadata-bin': base64.encode(binaryData) }

(where base64 is from dart:convert)

I'll keep this issue open to provide better support for binary metadata.

@ghost
Copy link

@ghost ghost commented May 9, 2018

+1. i need this too. Prefer not ot have to base64 it :)

@nevi-me
Copy link
Author

@nevi-me nevi-me commented May 9, 2018

@gedw99 from my understanding, you can successfully send binary metadata, the library doesn't yet go the extra mile of checking whether a *-bin contains binary data, but it shouldn't stop us from using binary metadata.

@ghost
Copy link

@ghost ghost commented May 9, 2018

@njovy
Copy link

@njovy njovy commented Apr 15, 2019

Any new update regarding this?

@mraleph
Copy link
Member

@mraleph mraleph commented Sep 28, 2020

I am going to close this issue to reflect that no special work is planned here. There is nothing preventing you from sending binary metadata, you just need to base64 encode it manually.

@mraleph mraleph closed this Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants