diff --git a/marconi/transport/helpers.py b/marconi/transport/helpers.py index 39f0e5deb..1add10f7f 100644 --- a/marconi/transport/helpers.py +++ b/marconi/transport/helpers.py @@ -30,7 +30,3 @@ def read_json(stream): def to_json(o): return json.dumps(o, ensure_ascii=False) - - -def join_params(d): - return '&'.join([k + '=' + str(v).lower() for k, v in d.items()]) diff --git a/marconi/transport/wsgi/claims.py b/marconi/transport/wsgi/claims.py index 9d55e17ab..335a9540d 100644 --- a/marconi/transport/wsgi/claims.py +++ b/marconi/transport/wsgi/claims.py @@ -31,7 +31,7 @@ class CollectionResource(object): raise falcon.HTTPBadRequest(_('Bad request'), _('Missing claim metadata.')) - #TODO(zyuan): use falcon's new api to check these + #TODO(zyuan): where do we define the limits? kwargs = { 'limit': req.get_param_as_int('limit'), } @@ -72,7 +72,7 @@ class ItemResource(object): tenant=tenant_id) meta['messages'] = list(msgs) - resp.content_location = req.path + resp.content_location = req.relative_uri resp.body = helpers.to_json(meta) resp.status = falcon.HTTP_200 diff --git a/marconi/transport/wsgi/messages.py b/marconi/transport/wsgi/messages.py index ea44e79ef..c091135d1 100644 --- a/marconi/transport/wsgi/messages.py +++ b/marconi/transport/wsgi/messages.py @@ -66,12 +66,11 @@ class CollectionResource(object): def on_get(self, req, resp, tenant_id, queue_name): uuid = req.get_header('Client-ID', required=True) - #TODO(zyuan): use falcon's new api to check these + #TODO(zyuan): where do we define the limits? kwargs = { 'marker': req.get_param('marker'), 'limit': req.get_param_as_int('limit'), - 'echo': {'true': True, - 'false': False}.get(req.get_param('echo')) + 'echo': req.get_param_as_bool('echo'), } kwargs = dict([(k, v) for k, v in kwargs.items() if v is not None]) @@ -96,11 +95,11 @@ class CollectionResource(object): resp_dict['links'] = [ { 'rel': 'next', - 'href': req.path + '?' + helpers.join_params(kwargs) + 'href': req.path + falcon.to_query_str(kwargs) } ] - resp.content_location = req.path + '?' + req.query_string + resp.content_location = req.relative_uri resp.body = helpers.to_json(resp_dict) resp.status = falcon.HTTP_200 else: @@ -120,7 +119,7 @@ class ItemResource(object): message_id=message_id, tenant=tenant_id) - resp.content_location = req.path + resp.content_location = req.relative_uri resp.body = helpers.to_json(msg) resp.status = falcon.HTTP_200 diff --git a/marconi/transport/wsgi/queues.py b/marconi/transport/wsgi/queues.py index d0be1e292..d17439f08 100644 --- a/marconi/transport/wsgi/queues.py +++ b/marconi/transport/wsgi/queues.py @@ -73,7 +73,7 @@ class ItemResource(object): raise falcon.HTTPServiceUnavailable(title, msg, 30) try: - resp.content_location = req.path + resp.content_location = req.relative_uri resp.body = helpers.to_json(doc) except TypeError as ex: LOG.error(ex) @@ -103,7 +103,7 @@ class CollectionResource(object): resp_dict['queues'] = list(queues) - resp.content_location = req.path + resp.content_location = req.relative_uri resp.body = helpers.to_json(resp_dict) resp.status = falcon.HTTP_200 diff --git a/tools/pip-requires b/tools/pip-requires index 248a454da..731fd3b5d 100644 --- a/tools/pip-requires +++ b/tools/pip-requires @@ -1,5 +1,5 @@ cliff -falcon +falcon>=0.1.4 msgpack-python oslo.config>=1.1.0 PasteDeploy