diff options
author | Erik Johnston <erik@matrix.org> | 2015-01-30 14:09:32 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-01-30 14:09:32 +0000 |
commit | 2aaedab2033119efb8c22fc2941aa341ea1e9de9 (patch) | |
tree | 14fd6e4eda613a51dda6736e2e672add87a2f723 /synapse/http/client.py | |
parent | Remove commented line (diff) | |
parent | We do need Twisted 14, not 15: we use internal Twisted things that have been ... (diff) | |
download | synapse-2aaedab2033119efb8c22fc2941aa341ea1e9de9.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into new_state_resolution
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 |