Mercurial > hg > orthanc-authorization
comparison Plugin/AuthorizationWebService.cpp @ 10:a2e3e7cd380e
set content-type to application.json
author | amazy |
---|---|
date | Mon, 11 Sep 2017 14:32:58 +0200 |
parents | d5d3cb00556a |
children | c44013681a51 |
comparison
equal
deleted
inserted
replaced
9:5125624e5cf3 | 10:a2e3e7cd380e |
---|---|
74 MemoryBuffer answerBody(context_); | 74 MemoryBuffer answerBody(context_); |
75 MemoryBuffer answerHeaders(context_); | 75 MemoryBuffer answerHeaders(context_); |
76 uint16_t httpStatus = 0; | 76 uint16_t httpStatus = 0; |
77 | 77 |
78 uint32_t headersCount = 0; | 78 uint32_t headersCount = 0; |
79 const char* headersKeys[1]; | 79 const char* headersKeys[2]; |
80 const char* headersValues[1]; | 80 const char* headersValues[2]; |
81 | 81 |
82 if (token != NULL && | 82 if (token != NULL && |
83 token->GetType() == TokenType_HttpHeader) | 83 token->GetType() == TokenType_HttpHeader) |
84 { | 84 { |
85 // If the token source is a HTTP header, forward it also as a | 85 // If the token source is a HTTP header, forward it also as a |
86 // HTTP header | 86 // HTTP header |
87 headersCount = 1; | 87 headersKeys[headersCount] = token->GetKey().c_str(); |
88 headersKeys[0] = token->GetKey().c_str(); | 88 headersValues[headersCount] = tokenValue.c_str(); |
89 headersValues[0] = tokenValue.c_str(); | 89 headersCount++; |
90 } | 90 } |
91 | |
92 // set the correct content type for the outgoing | |
93 headersKeys[headersCount] = "Content-Type"; | |
94 headersValues[headersCount] = "application/json"; | |
95 headersCount++; | |
91 | 96 |
92 std::string flatBody = body.toStyledString(); | 97 std::string flatBody = body.toStyledString(); |
93 | 98 |
94 if (OrthancPluginHttpClient(context_, *answerBody, *answerHeaders, | 99 if (OrthancPluginHttpClient(context_, *answerBody, *answerHeaders, |
95 &httpStatus, OrthancPluginHttpMethod_Post, | 100 &httpStatus, OrthancPluginHttpMethod_Post, |