Skip to content
This repository was archived by the owner on Jan 27, 2022. It is now read-only.

Commit 000af2f

Browse files
Ramakrishna SrinivasamurthyRam-srini
authored andcommitted
Content type application/x-www-form-urlencoded is required
to support curl command. Signed-off-by: Ramakrishna Srinivasamurthy <[email protected]>
1 parent 8b5789a commit 000af2f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

common/python/listener/base_jrpc_listener.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ def render_POST(self, request):
136136
# process the message encoding
137137
encoding = request.getHeader('Content-Type')
138138
data = request.content.read()
139-
if encoding == 'application/json':
139+
# To support curl command content type
140+
# 'application/x-www-form-urlencoded' required
141+
if encoding in ['application/json',
142+
'application/x-www-form-urlencoded']:
140143
input_json_str = data.decode('utf-8')
141144
response = self._process_request(input_json_str)
142145

@@ -163,7 +166,8 @@ def render_POST(self, request):
163166

164167
# send back the results
165168
try:
166-
if encoding == 'application/json':
169+
if encoding in ['application/json',
170+
'application/x-www-form-urlencoded']:
167171
response = json.dumps(response)
168172
logger.info('response[%s]: %s', encoding, response)
169173
request.setHeader('content-type', encoding)

0 commit comments

Comments
 (0)