From ea811147736813a99fe7b16cd77d0be73bc7476b Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 2 Sep 2021 20:07:05 +0300 Subject: [PATCH] add http:set_headers function --- README.md | 3 ++- README_ru.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7bb3a77..1463fa3 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,8 @@ Sorting options: * `http:get(url, [id])` - executes an HTTP GET request, id - the request identifier string (see below); * `http:post(url, body, media_type, [id])` - executes an HTTP POST request; * `http:put(url, body, media_type, [id])` - executes an HTTP request; -* `http:delete(url, [id])` - executes an HTTP DELETE request. +* `http:delete(url, [id])` - executes an HTTP DELETE request; +* `http:set_headers(table) - sets the headers for **all** subsequent network requests; the argument is a table with strings like "Cache-Control: no-cache". These functions do not return any value, but instead call the `on_network_result(string, [code])` callback. The first argument is the body of the response, the second (optional) is the code (200, 404, etc.). diff --git a/README_ru.md b/README_ru.md index f690323..f1f260e 100644 --- a/README_ru.md +++ b/README_ru.md @@ -120,7 +120,8 @@ ui:show_context_menu({ * `http:get(url, [id])` - выполняет запрос HTTP GET, id - строка-идентификатор запрос (см. ниже); * `http:post(url, body, media_type, [id])` - выполняет запрос HTTP POST; * `http:put(url, body, media_type, [id])` - выполняет запрос HTTP; -* `http:delete(url, [id])` - выполняет запрос HTTP DELETE. +* `http:delete(url, [id])` - выполняет запрос HTTP DELETE; +* `http:set_headers(table)` - устанавливает заголовки для **всех** последующих сетевых запросов; аргумент - таблица со строками типа "Cache-Control: no-cache". Эти функции не возвращают никакого значения, а вместо этого вызывают колбек `on_network_result(string, [code])`. Первый аргумент: тело ответа, второй (опциональный) - код (200, 404 и т.д.).