comparison Core/RestApi/RestApiOutput.cpp @ 1368:b22ba8c5edbe query-retrieve

query retrieve
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 26 May 2015 17:54:34 +0200
parents 6e7e5ed91c2d
children f967bdf8534e
comparison
equal deleted inserted replaced
1367:fe6e5a9f1ea2 1368:b22ba8c5edbe
38 38
39 #include "../OrthancException.h" 39 #include "../OrthancException.h"
40 40
41 namespace Orthanc 41 namespace Orthanc
42 { 42 {
43 RestApiOutput::RestApiOutput(HttpOutput& output) : 43 RestApiOutput::RestApiOutput(HttpOutput& output,
44 HttpMethod method) :
44 output_(output), 45 output_(output),
46 method_(method),
45 convertJsonToXml_(false) 47 convertJsonToXml_(false)
46 { 48 {
47 alreadySent_ = false; 49 alreadySent_ = false;
48 } 50 }
49 51
53 55
54 void RestApiOutput::Finalize() 56 void RestApiOutput::Finalize()
55 { 57 {
56 if (!alreadySent_) 58 if (!alreadySent_)
57 { 59 {
58 output_.SendStatus(HttpStatus_404_NotFound); 60 if (method_ == HttpMethod_Post)
61 {
62 output_.SendStatus(HttpStatus_400_BadRequest);
63 }
64 else
65 {
66 output_.SendStatus(HttpStatus_404_NotFound);
67 }
59 } 68 }
60 } 69 }
61 70
62 void RestApiOutput::CheckStatus() 71 void RestApiOutput::CheckStatus()
63 { 72 {