changeset 10:a2e3e7cd380e

set content-type to application.json
author amazy
date Mon, 11 Sep 2017 14:32:58 +0200
parents 5125624e5cf3
children 544732bbd87b
files Plugin/AuthorizationWebService.cpp
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/AuthorizationWebService.cpp	Wed Jul 19 09:17:56 2017 +0200
+++ b/Plugin/AuthorizationWebService.cpp	Mon Sep 11 14:32:58 2017 +0200
@@ -76,19 +76,24 @@
     uint16_t httpStatus = 0;
 
     uint32_t headersCount = 0;
-    const char* headersKeys[1];
-    const char* headersValues[1];
+    const char* headersKeys[2];
+    const char* headersValues[2];
       
     if (token != NULL &&
         token->GetType() == TokenType_HttpHeader)
     {
       // If the token source is a HTTP header, forward it also as a
       // HTTP header
-      headersCount = 1;
-      headersKeys[0] = token->GetKey().c_str();
-      headersValues[0] = tokenValue.c_str();
+      headersKeys[headersCount] = token->GetKey().c_str();
+      headersValues[headersCount] = tokenValue.c_str();
+      headersCount++;
     }
 
+    // set the correct content type for the outgoing
+    headersKeys[headersCount] = "Content-Type";
+    headersValues[headersCount] = "application/json";
+    headersCount++;
+
     std::string flatBody = body.toStyledString();
       
     if (OrthancPluginHttpClient(context_, *answerBody, *answerHeaders,