client:set_header

March 26, 2020 Contributors

Name

client:set_header — Set an HTTP header

Synopsis

require('msys.http.client')

client:set_header(header);

header: string (optional)

Description

Set a client’s HTTP header. To set multiple headers, invoke this function multiple times. Calling this function with no arguments will clear the headers.

function httpclient_test_post(url, postdata)
  client:set_header("Content-Type: text/xml; charset=utf-8");
  client:do_request("POST", url, postdata);
end

See Also

msys.http.client.new, client:set_timeout, client:do_request, client:get_status, client:get_body, client:parse_headers client:get_headers