diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-11 10:33:19 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-11 10:33:19 +0000 |
commit | fb233dc40b3111e905e394e627b8ecc3b2a91e80 (patch) | |
tree | 931ab474f042b5eb5df9663306a4936406dcf17c /synapse/http/client.py | |
parent | PEP8 (diff) | |
parent | Merge branch 'master' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-fb233dc40b3111e905e394e627b8ecc3b2a91e80.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into timeout-federation-requests
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r-- | synapse/http/client.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py index 7793bab106..198f575cfa 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -63,6 +63,25 @@ class SimpleHttpClient(object): defer.returnValue(json.loads(body)) @defer.inlineCallbacks + def post_json_get_json(self, uri, post_json): + json_str = json.dumps(post_json) + + logger.info("HTTP POST %s -> %s", json_str, uri) + + response = yield self.agent.request( + "POST", + uri.encode("ascii"), + headers=Headers({ + "Content-Type": ["application/json"] + }), + bodyProducer=FileBodyProducer(StringIO(json_str)) + ) + + body = yield readBody(response) + + defer.returnValue(json.loads(body)) + + @defer.inlineCallbacks def get_json(self, uri, args={}): """ Get's some json from the given host and path |