From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 621EC28695 for ; Mon, 22 Apr 2019 11:00:49 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I_UG_ZgKYKuI for ; Mon, 22 Apr 2019 11:00:49 -0400 (EDT) Received: from smtp54.i.mail.ru (smtp54.i.mail.ru [217.69.128.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id A87C128692 for ; Mon, 22 Apr 2019 11:00:48 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 1/1] box: updated httpc error message References: <0ea35912fd62474e517d9a4bc422f944112ab41c.1555938495.git.kshcherbatov@tarantool.org> <20190422131857.pvnh2ws6ittwlfrc@tkn_work_nb> From: Kirill Shcherbatov Message-ID: Date: Mon, 22 Apr 2019 18:00:45 +0300 MIME-Version: 1.0 In-Reply-To: <20190422131857.pvnh2ws6ittwlfrc@tkn_work_nb> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org, Alexander Turenko > I woudl replace 'test httpc usage' with 'test httpc usage error'. > > tostring() is not necessary here (the error is just a Lua string). > > Please add 'gh-xxxx: short description' comment. Done. Ok. Previously Tarantool used to raise the confusing error message in case of invalid usage of the httpc module. Fixed to follow the current module API. Closes #4136 --- src/lua/httpc.lua | 2 +- test/app-tap/http_client.test.lua | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lua/httpc.lua b/src/lua/httpc.lua index cd44b6054..b767d14eb 100644 --- a/src/lua/httpc.lua +++ b/src/lua/httpc.lua @@ -294,7 +294,7 @@ curl_mt = { -- request = function(self, method, url, body, opts) if not method or not url then - error('request(method, url [, options]])') + error('request(method, url [, body, [options]])') end local resp = self.curl:request(method, url, body, opts or {}) if resp and resp.headers then diff --git a/test/app-tap/http_client.test.lua b/test/app-tap/http_client.test.lua index 0a323be9b..01f6de5c0 100755 --- a/test/app-tap/http_client.test.lua +++ b/test/app-tap/http_client.test.lua @@ -62,7 +62,13 @@ local function stop_server(test, server) end local function test_http_client(test, url, opts) - test:plan(10) + test:plan(11) + + -- gh-4136: confusing httpc usage error message + local ok, err = pcall(client.request, client) + local usage_err = "request(method, url [, body, [options]])" + test:is_deeply({ok, err:split(': ')[2]}, {false, usage_err}, + "test httpc usage error") test:isnil(rawget(_G, 'http'), "global namespace is not polluted"); test:isnil(rawget(_G, 'http.client'), "global namespace is not polluted"); -- 2.21.0