Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2994

Node.js TJSONProtocol cannot be used for object serialization.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.10.0
    • Node.js - Library
    • None

    Description

      Consider the following code using the Thrift example types.

      serialize.js
      var thrift = require('thrift');
      var test_types = require('gen-nodejs/ThriftTest_types.js');
      
      var bonk = new test_types.Bonk({message: "message", type: 6})
      var t_out = new thrift.TBufferedTransport();
      var p_out = new thrift.TJSONProtocol(t_out);
      bonk.write(p_out);
      var out
      t_out.flush(function (b) { out = b;});
      console.log(out)
      

      My expectation would be for out to contain the serialized Bonk struct.
      But due to TJSONProtocol only writing to the underlying transport in writeMessageEnd the above code does not work.

      Attachments

        Activity

          People

            bracki Jan Brauer
            bracki Jan Brauer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: