in source/http_headers.c [31:148]
napi_status aws_napi_http_headers_bind(napi_env env, napi_value exports) {
static const struct aws_napi_method_info s_headers_constructor_info = {
.name = "HttpHeaders",
.method = s_headers_constructor,
.num_arguments = 0,
.arg_types = {napi_object},
};
static const struct aws_napi_property_info s_headers_properties[] = {
{
.name = "length",
.type = napi_number,
.getter = s_headers_length_get,
.attributes = napi_enumerable,
},
};
static const struct aws_napi_method_info s_headers_methods[] = {
{
.name = "get",
.method = s_headers_get,
.num_arguments = 1,
.arg_types = {napi_string},
},
{
.name = "get_values",
.method = s_headers_get_values,
.num_arguments = 1,
.arg_types = {napi_string},
},
{
.name = "get_index",
.method = s_headers_get_index,
.num_arguments = 1,
.arg_types = {napi_number},
},
{
.symbol = "iterator",
.method = s_headers__iterator,
},
{
.name = "add",
.method = s_headers_add_header,
.num_arguments = 2,
.arg_types = {napi_string, napi_string},
},
{
.name = "set",
.method = s_headers_set_header,
.num_arguments = 2,
.arg_types = {napi_string, napi_string},
},
{
.name = "remove",
.method = s_headers_remove,
.num_arguments = 1,
.arg_types = {napi_string},
},
{
.name = "remove_value",
.method = s_headers_remove_value,
.num_arguments = 2,
.arg_types = {napi_string, napi_string},
},
{
.name = "clear",
.method = s_headers_clear,
.num_arguments = 0,
},
{
.name = "_flatten",
.method = s_headers__flatten,
.num_arguments = 0,
},
};
AWS_NAPI_CALL(
env,
aws_napi_define_class(
env,
exports,
&s_headers_constructor_info,
s_headers_properties,
AWS_ARRAY_SIZE(s_headers_properties),
s_headers_methods,
AWS_ARRAY_SIZE(s_headers_methods),
&s_headers_class_info),
{ return status; });
static const napi_property_descriptor s_iterator_properties[] = {
{
.utf8name = "next",
.method = s_iterator_next,
.attributes = napi_enumerable,
},
};
napi_value iterator_ctor = NULL;
AWS_NAPI_CALL(
env,
napi_define_class(
env,
"Iterator",
NAPI_AUTO_LENGTH,
s_iterator_ctor,
NULL,
AWS_ARRAY_SIZE(s_iterator_properties),
s_iterator_properties,
&iterator_ctor),
{ return status; });
AWS_NAPI_CALL(env, napi_create_reference(env, iterator_ctor, 1, &s_iterator_constructor), { return status; });
return napi_ok;
}