When sending a protobuf payload it's sending fully encoded NULL trailing values

45 Views Asked by At

when sending a protobuf protobufjs request using axios in vue3 js, it seems to be filling the buffer with trailing NULL values, causing my backend to fail the decode cannot parse invalid wire-format data. Is this standard or am I missing something?

//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',
  },
});

enter image description here

0

There are 0 best solutions below