ua_conn_add_header - add a header/field pair#

void ua_conn_add_header(struct ua_conn *conn, const char field[], const char value[])#

Add a field/value pair to the request header.

Parameters:
  • conn – the connection handle

  • field – header’s field to be added

  • value – field’s value

Example#

struct user_agent *ua = ua_init(NULL);
ua_set_url(ua, "https://www.example.com");

struct ua_conn_attr conn_attr = { .method = HTTP_GET };
struct ua_conn *conn = ua_conn_start(ua);
ua_conn_setup(conn, &conn_attr);

ua_conn_add_header(conn, "User-Agent", "my_application");
ua_conn_add_header(conn, "Authorization", "Bearer xyzABC");

ua_conn_easy_perform(conn);

ua_conn_stop(conn);
ua_cleanup(ua);