Permalink
Browse files

Fix trailing comma in JSON ResponseStatus when DebugMode = false

  • Loading branch information...
1 parent 7d42ce1 commit e79dee1178a91cc4e5752c11fdf69488368d9fd5 @jorbor committed Aug 24, 2012
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 e79dee1

Please sign in to comment.