Commit f0fd3086 authored by Alejandro Alvarez Ayllon's avatar Alejandro Alvarez Ayllon
Browse files

Context.post_json improvements

parent f90cfd3a
# Copyright notice:
# Copyright Members of the EMI Collaboration, 2013.
#
#
# See www.eu-emi.eu for details on the copyright holders
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
......@@ -144,7 +144,9 @@ class Context(object):
"%s/%s" % (self.endpoint, path))
def post_json(self, path, body):
if not isinstance(body, str) and not isinstance(body, unicode):
body = json.dumps(body)
return self._requester.method('POST',
"%s/%s" % (self.endpoint, path),
body,
headers={'Content-Type': 'text/json'})
headers={'Content-Type': 'application/json'})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment