lib/asir/transport/http.rb in asir-1.1.12 vs lib/asir/transport/http.rb in asir-1.2.0

- old
+ new

@@ -28,21 +28,26 @@ @client = nil unless Channel === @client end # Send the Message payload String using HTTP POST. # Returns the HTTPClient::Request response object. - def _send_message message, message_payload + def _send_message state client.with_stream! do | client | - client.post(uri, message_payload) + state.in_stream = + client.post(message_uri(state), state.message_payload) end end + # Subclasses can override. + def message_uri state + state.message[:uri] || uri + end + # Recieve the Result payload String from the opaque # HTTPClient::Request response object returned from #_send_message. - def _receive_result message, http_result_message - # $stderr.puts " ### http_result_message.content.encoding = #{http_result_message.content.encoding.inspect}" rescue nil - # $stderr.puts " ### http_result_message.content = #{http_result_message.content.inspect}" rescue nil - http_result_message.content.to_s + def _receive_result state + state.result_payload = + state.in_stream.content.to_s end CONTENT_TYPE = 'Content-Type'.freeze APPLICATION_BINARY = 'application/binary'.freeze