@@ -85,6 +85,11 @@ class invocation_response {
8585 */
8686 bool m_success;
8787
88+ /* *
89+ * The serialized XRay response header.
90+ */
91+ std::string m_xray_response;
92+
8893 /* *
8994 * Instantiate an empty response. Used by the static functions 'success' and 'failure' to create a populated
9095 * invocation_response
@@ -97,10 +102,12 @@ class invocation_response {
97102 // To support clients that need to control the entire error response body (e.g. adding a stack trace), this
98103 // constructor should be used instead.
99104 // Note: adding an overload to invocation_response::failure is not feasible since the parameter types are the same.
100- invocation_response (std::string const & payload, std::string const & content_type, bool success)
101- : m_payload(payload), m_content_type(content_type), m_success(success)
102- {
103- }
105+ invocation_response (std::string const & payload, std::string const & content_type, bool success, std::string const & xray_response = " " ):
106+ m_payload (payload),
107+ m_content_type (content_type),
108+ m_success (success),
109+ m_xray_response (xray_response)
110+ {}
104111
105112 /* *
106113 * Create a successful invocation response with the given payload and content-type.
@@ -111,7 +118,7 @@ class invocation_response {
111118 * Create a failure response with the given error message and error type.
112119 * The content-type is always set to application/json in this case.
113120 */
114- static invocation_response failure (std::string const & error_message, std::string const & error_type);
121+ static invocation_response failure (std::string const & error_message, std::string const & error_type, std::string const & xray_response = " " );
115122
116123 /* *
117124 * Get the MIME type of the payload.
@@ -127,6 +134,11 @@ class invocation_response {
127134 * Returns true if the payload and content-type are set. Returns false if the error message and error types are set.
128135 */
129136 bool is_success () const { return m_success; }
137+
138+ /* *
139+ * Get the XRay response string. The string isassumed to be UTF-8 encoded.
140+ */
141+ std::string const & get_xray_response () const { return m_xray_response; }
130142};
131143
132144struct no_result {};
0 commit comments