Permalink
Browse files

Merge pull request #233 from jorbor/master

Fix illegal JSON response
  • Loading branch information...
mythz committed Aug 24, 2012
2 parents 7d42ce1 + e79dee1 commit c24965f428c419f4666e1b0938b8fe3e4120a255
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/ServiceStack/WebHost.Endpoints/Extensions/IHttpResponseExtensions.cs
@@ -334,8 +334,9 @@ private static void WriteJsonErrorToResponse(this IHttpResponse response, string
sb.AppendLine("{");
sb.AppendLine("\"ResponseStatus\":{");
sb.AppendFormat(" \"ErrorCode\":{0},\n", ex.ToErrorCode().EncodeJson());
- sb.AppendFormat(" \"Message\":{0},\n", ex.Message.EncodeJson());
- if (EndpointHost.Config.DebugMode) sb.AppendFormat(" \"StackTrace\":{0}\n", ex.StackTrace.EncodeJson());
+ sb.AppendFormat(" \"Message\":{0}", ex.Message.EncodeJson());
+ if (EndpointHost.Config.DebugMode) sb.AppendFormat(",\n \"StackTrace\":{0}\n", ex.StackTrace.EncodeJson());
+ else sb.Append("\n");
sb.AppendLine("}");
sb.AppendLine("}");

0 comments on commit c24965f

Please sign in to comment.