merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit ee0fb929d7bcb1dbcaf29ef88a38ad9b5e89e756
parent 0217dadb0668f1f17d7b674181cc521a063dfca6
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Tue,  2 May 2017 09:00:43 +0200

The mitm do NOT copy header Content-Lenght and Server into
the response; it used to return ill-formed JSONs.

Diffstat:
Msrc/mitm/talermerchantmitm/mitm.py | 11+++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/mitm/talermerchantmitm/mitm.py b/src/mitm/talermerchantmitm/mitm.py @@ -47,12 +47,6 @@ def track_transaction(resp): def track_transfer(resp): return resp -def fallback(resp): - if "application/json" == resp.headers["Content-Type"]: - return make_response(jsonify(resp.json())) - else: - return make_response(resp.text) - @app.route('/', defaults={'path': ''}) @app.route('/<path:path>', methods=["GET", "POST"]) def all(path): @@ -71,8 +65,9 @@ def all(path): "track_transfer": track_transfer } func = dispatcher.get(request.headers.get("X-Taler-Mitm"), - fallback) + lambda x: make_response(x.text)) response = func(r) for key, value in r.headers.items(): - response.headers[key] = value + if key not in ("Server", "Content-Length"): + response.headers[key] = value return response, r.status_code