diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2017-12-07 08:25:50 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2017-12-08 07:41:15 +0900 |
commit | 74bfdcd555a6f737c58daa4622e75108dba5e21f (patch) | |
tree | 60254d0f5d0321837dccaf658c99065a50c7b987 /org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server | |
parent | 239043e59d78b6c8661eb9fcd51189887c081770 (diff) | |
download | jgit-74bfdcd555a6f737c58daa4622e75108dba5e21f.tar.gz jgit-74bfdcd555a6f737c58daa4622e75108dba5e21f.zip |
FileLfsServlet: Do not pretty print json response
Pretty printing the response is useful for human readers, but most
(if not all) of the time, the response will be read by programs.
Remove it to avoid the additional overhead of the formatting and
extra bytes in the response. Adjust the test accordingly.
Note that LfsProtocolServlet already doesn't use pretty printing,
so this change makes FileLfsServlet's behavior consistent. In fact,
both classes now have duplicate Gson handling; this will be cleaned
up in a separate change.
Change-Id: I113a23403f9222f16e2c0ddf39461398b721d064
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server')
-rw-r--r-- | org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java index a8e3c11e27..b13beb5953 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java @@ -211,10 +211,9 @@ public class FileLfsServlet extends HttpServlet { } private static Gson createGson() { - GsonBuilder gb = new GsonBuilder() - .setFieldNamingPolicy( - FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) - .setPrettyPrinting().disableHtmlEscaping(); - return gb.create(); + return new GsonBuilder() + .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) + .disableHtmlEscaping() + .create(); } } |