Skip to content

Commit d2c5bd9

Browse files
committed
Merge pull request #589 from sporty81/master
when tracing is enabled, log the actual json request
2 parents 903060e + 872e59e commit d2c5bd9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: src/Elasticsearch.Net/Domain/ElasticsearchResponse.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,19 @@ public override string ToString()
196196
else if (typeof(T) == typeof(byte[]))
197197
response = (this.Response as byte[]).Utf8String();
198198

199+
string requestJson = null;
200+
201+
if (r.Request != null)
202+
{
203+
requestJson = r.Request.Utf8String();
204+
}
205+
199206
var print = _printFormat.F(
200207
Environment.NewLine,
201208
r.HttpStatusCode.HasValue ? r.HttpStatusCode.Value.ToString(CultureInfo.InvariantCulture) : "-1",
202209
r.RequestMethod,
203210
r.RequestUrl,
204-
r.Request,
211+
requestJson,
205212
response
206213
);
207214
if (!this.Success && e != null)

0 commit comments

Comments
 (0)