protobufjs/protobuf.js

When sending a payload I'm getting trailing NULLs

wes-kay opened this issue · 0 comments

protobuf.js version: latest

Following the example in the README when sending a request it seems to be filling the buffer with trailing NULL, am I missing something? Are my encoding settings wrong?

//generating my .proto files with: `npx pbjs --target static-module --wrap commonjs --out proto_bundle.js *.proto`
message AccountSigninRequestHandler_pb {
  string email = 1;
  string password = 2;
}

//That generates my handlers and then I construct them and send them off:

const requestBinary = AccountSigninRequestHandler_pb .encode({
  email: email || null,
  password: password || null
}).finish();
const response = await axios.post(BASE_API_URL + BASE_API_VERSION_URL + 'signin', requestBinary, {
  headers: {
    'Content-Type': 'application/octet-stream',
  },
});

Here's the payload:

Screenshot_46

Here's the server request:

Screenshot_48