From 45f49d393e24cd8f9ae49712dc4172d01cd80a13 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sat, 11 Jan 2014 18:56:16 -0600 Subject: [PATCH] Added Content-Type header for POST request with HttpContext. --- project.properties | 6 +++--- src/main/com/jdbernard/net/HttpContext.groovy | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/project.properties b/project.properties index fafceaf..78f330b 100644 --- a/project.properties +++ b/project.properties @@ -1,6 +1,6 @@ -#Sat, 21 Sep 2013 02:27:46 -0500 +#Sat, 11 Jan 2014 18:55:50 -0600 name=jdb-util -version=2.2 +version=2.3 lib.local=true -build.number=8 +build.number=0 diff --git a/src/main/com/jdbernard/net/HttpContext.groovy b/src/main/com/jdbernard/net/HttpContext.groovy index fbe3162..b4d1186 100644 --- a/src/main/com/jdbernard/net/HttpContext.groovy +++ b/src/main/com/jdbernard/net/HttpContext.groovy @@ -47,9 +47,9 @@ public class HttpContext { message.append("\r\n") } if (request) { - def jsonRequestBuilder = new JsonBuilder(request) - String requestBody = jsonRequestBuilder.toString() + String requestBody = new JsonBuilder(request).toString() + message.append("Content-Type: application/json\r\n") message.append("Content-Length: ") message.append(requestBody.length()) message.append("\r\n\r\n")