From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: tarantool-patches@dev.tarantool.org, lvasiliev@tarantool.org Cc: Sergey Bronnikov <estetus@gmail.com>, alexander.turenko@tarantool.org Subject: [Tarantool-patches] [PATCH v1 1/4] test: fix app-tap/http_client.test.lua Date: Wed, 13 Jan 2021 11:48:30 +0300 [thread overview] Message-ID: <c7202800298740fc6da3446b2c987067167f0d34.1610526975.git.estetus@gmail.com> (raw) In-Reply-To: <cover.1610526975.git.estetus@gmail.com> From: Sergey Bronnikov <estetus@gmail.com> Pass http body as byte string and define string literals correctly. Part of #5538 --- test/app-tap/httpd.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/app-tap/httpd.py b/test/app-tap/httpd.py index a2dee1b83..62435e91a 100755 --- a/test/app-tap/httpd.py +++ b/test/app-tap/httpd.py @@ -7,24 +7,24 @@ from gevent import spawn, sleep, socket def absent(): code = "500 Server Error" headers = [("Content-Type", "application/json")] - body = ["No such method"] + body = [b'No such method'] return code, body, headers def hello(): code = "200 OK" - body = ["hello world"] + body = [b'hello world'] headers = [("Content-Type", "application/json")] return code, body, headers def hello1(): code = "200 OK" - body = [b"abc"] + body = [b'abc'] headers = [("Content-Type", "application/json")] return code, body, headers def headers(): code = "200 OK" - body = [b"cookies"] + body = [b'cookies'] headers = [("Content-Type", "application/json"), ("Content-Type", "application/yaml"), ("Set-Cookie", "likes=cheese; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly"), @@ -41,13 +41,13 @@ def headers(): def long_query(): sleep(0.005) code = "200 OK" - body = [b"abc"] + body = [b'abc'] headers = [("Content-Type", "application/json")] return code, body, headers def redirect(): code = "302 Found" - body = ["redirecting"] + body = [b'redirecting'] headers = [("Location", "/")] return code, body, headers @@ -63,7 +63,7 @@ paths = { def read_handle(env, response): code = "404 Not Found" headers = [] - body = ["Not Found"] + body = [b'Not Found'] if env["PATH_INFO"] in paths: code, body, headers = paths[env["PATH_INFO"]]() for key,value in iter(env.items()): @@ -76,7 +76,7 @@ def post_handle(env, response): code = "200 OK" body = [env["wsgi.input"].read()] headers = [] - for key,value in env.iteritems(): + for key,value in iter(env.items()): if "HTTP_" in key: headers.append((key[5:].lower(), value)) response(code, headers) @@ -84,8 +84,8 @@ def post_handle(env, response): def other_handle(env, response, method, code): headers = [("Content-Type", "text/plain"), ("method", method)] - body = [method] - for key,value in env.iteritems(): + body = [method.encode('utf-8')] + for key,value in iter(env.items()): if "HTTP_" in key: headers.append((key[5:].lower(), value)) response(code, headers) -- 2.25.1
next prev parent reply other threads:[~2021-01-13 8:49 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-13 8:48 [Tarantool-patches] [PATCH v1 0/4] Support Python 3 in Tarantool tests Sergey Bronnikov via Tarantool-patches 2021-01-13 8:48 ` Sergey Bronnikov via Tarantool-patches [this message] 2021-01-14 8:47 ` [Tarantool-patches] [PATCH v1 1/4] test: fix app-tap/http_client.test.lua Leonid Vasiliev via Tarantool-patches 2021-01-14 9:50 ` Sergey Bronnikov via Tarantool-patches 2021-01-14 12:23 ` Alexander Turenko via Tarantool-patches 2021-01-14 12:52 ` Sergey Bronnikov via Tarantool-patches 2021-01-14 12:57 ` Alexander Turenko via Tarantool-patches 2021-01-13 8:48 ` [Tarantool-patches] [PATCH v1 2/4] test: fix xlog-py/big_lsn.test.py Sergey Bronnikov via Tarantool-patches 2021-01-14 9:02 ` Leonid Vasiliev via Tarantool-patches 2021-01-14 9:51 ` Sergey Bronnikov via Tarantool-patches 2021-01-14 12:38 ` Alexander Turenko via Tarantool-patches 2021-01-14 12:52 ` Sergey Bronnikov via Tarantool-patches 2021-01-13 8:48 ` [Tarantool-patches] [PATCH v1 3/4] test: enable SO_REUSEADDR on socket in httpd.py Sergey Bronnikov via Tarantool-patches 2021-01-13 19:59 ` Cyrill Gorcunov via Tarantool-patches 2021-01-14 9:09 ` Leonid Vasiliev via Tarantool-patches 2021-01-14 9:57 ` Sergey Bronnikov via Tarantool-patches 2021-01-14 12:51 ` Alexander Turenko via Tarantool-patches 2021-01-13 8:48 ` [Tarantool-patches] [PATCH v1 4/4] test: enable disabled testcases back Sergey Bronnikov via Tarantool-patches 2021-01-14 9:10 ` Leonid Vasiliev via Tarantool-patches 2021-01-13 20:03 ` [Tarantool-patches] [PATCH v1 0/4] Support Python 3 in Tarantool tests Cyrill Gorcunov via Tarantool-patches 2021-01-14 11:10 ` Leonid Vasiliev via Tarantool-patches 2021-01-15 9:34 ` Kirill Yukhin via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=c7202800298740fc6da3446b2c987067167f0d34.1610526975.git.estetus@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=estetus@gmail.com \ --cc=lvasiliev@tarantool.org \ --cc=sergeyb@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v1 1/4] test: fix app-tap/http_client.test.lua' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox