Mercurial > hg > orthanc
comparison Core/HttpServer/HttpOutput.cpp @ 1567:9c5d93510414
If error while calling the REST API, the answer body contains an error description
author | jodogne |
---|---|
date | Sun, 23 Aug 2015 09:49:16 +0200 |
parents | c388502a066d |
children | d73124f6b439 |
comparison
equal
deleted
inserted
replaced
1566:3be6eb3757c8 | 1567:9c5d93510414 |
---|---|
285 stateMachine_.AddHeader("Allow", allowed); | 285 stateMachine_.AddHeader("Allow", allowed); |
286 stateMachine_.SendBody(NULL, 0); | 286 stateMachine_.SendBody(NULL, 0); |
287 } | 287 } |
288 | 288 |
289 | 289 |
290 void HttpOutput::SendStatus(HttpStatus status) | 290 void HttpOutput::SendStatus(HttpStatus status, |
291 const char* message, | |
292 size_t messageSize) | |
291 { | 293 { |
292 if (status == HttpStatus_200_Ok || | 294 if (status == HttpStatus_200_Ok || |
293 status == HttpStatus_301_MovedPermanently || | 295 status == HttpStatus_301_MovedPermanently || |
294 status == HttpStatus_401_Unauthorized || | 296 status == HttpStatus_401_Unauthorized || |
295 status == HttpStatus_405_MethodNotAllowed) | 297 status == HttpStatus_405_MethodNotAllowed) |
298 throw OrthancException(ErrorCode_ParameterOutOfRange); | 300 throw OrthancException(ErrorCode_ParameterOutOfRange); |
299 } | 301 } |
300 | 302 |
301 stateMachine_.ClearHeaders(); | 303 stateMachine_.ClearHeaders(); |
302 stateMachine_.SetHttpStatus(status); | 304 stateMachine_.SetHttpStatus(status); |
303 stateMachine_.SendBody(NULL, 0); | 305 stateMachine_.SendBody(message, messageSize); |
304 } | 306 } |
305 | 307 |
306 | 308 |
307 void HttpOutput::Redirect(const std::string& path) | 309 void HttpOutput::Redirect(const std::string& path) |
308 { | 310 { |