xiazcy opened a new pull request, #3358:
URL: https://github.com/apache/tinkerpop/pull/3358

   Go serializes request before passing to interceptors, which was a concern 
highlighted in .NET PR review and deviating from other GLVs. This PR mainly 
fixes that by changing order of operation, and passing in the raw request 
message to interceptors first, then serialize the request. 
   
   Slightly different design from .NET and python, as go DRC/client API did not 
expose the `serializer` setting to users. Here by default, if interceptor does 
not perform serialization, then the unserialized `request` (now 
`RequestMessage`) gets serialized by GraphBinary into `byte[]`. If users wish 
to use their own serializer via interceptors, they should return either 
`byte[]`, `io.Reader`, or a `http.Request`, which are the types accepted by the 
http client library.
   
   Some minor fixes also tagging along here:
   - Changed `request` struct to `RequestMessage`, as it can get confusing with 
an http.Request. Also exported the type for easier interceptor access, and is 
now consistent as this is public also in other GLVs.
   - Added json/plain text error handling that was missing
   - Added WaitGroup to ensure in-flight goroutines complete before close
   - Drained response body before close to prevent TCP RST errors (results in 
harmless but annoying errors from server)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to