summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2020-01-16 11:48:57 +0100
committerAlvaro Neira Ayuso <alvaroneay@gmail.com>2020-01-19 19:50:44 +0100
commit3a44e48e4be912d66c2f634a0e4d1a33132b15b6 (patch)
treec1c80838bb1f670c7cd204d5b4e4cd0895fcb8d9 /src
parent3c450b0d8179254ac38f925e084ece8388a2dee1 (diff)
Adapt client responses to the server's
Header parameters need to be sorted for the test server.
Diffstat (limited to 'src')
-rw-r--r--src/ogRest.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ogRest.py b/src/ogRest.py
index 7d9120f..dcc0817 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -24,7 +24,7 @@ class restResponse():
def getResponse(response, jsonResp=None):
msg = ''
if response == ogResponses.BAD_REQUEST:
- msg = 'HTTP/1.0 400 Bad request'
+ msg = 'HTTP/1.0 400 Bad Request'
elif response == ogResponses.IN_PROGRESS:
msg = 'HTTP/1.0 202 Accepted'
elif response == ogResponses.OK:
@@ -34,12 +34,15 @@ class restResponse():
else:
return msg
- if not jsonResp == None:
- msg = msg + '\nContent-Type:application/json'
- msg = msg + '\nContent-Length:' + str(len(jsonResp.dumpMsg()))
- msg = msg + '\n' + jsonResp.dumpMsg()
+ msg += '\r\n'
+
+ if jsonResp:
+ msg += 'Content-Length:' + str(len(jsonResp.dumpMsg()))
+ msg += '\r\nContent-Type:application/json'
+ msg += '\r\n\r\n' + jsonResp.dumpMsg()
+ else:
+ msg += '\r\n'
- msg = msg + '\r\n\r\n'
return msg
class ogThread():