bool set(JSContext *cx, unsigned argc, Value *vp) {
  METHOD_HEADER(2)

  NORMALIZE_NAME(args[0], "Headers.set")
  NORMALIZE_VALUE(args[1], "Headers.set")

  Mode mode = detail::mode(self);
  if (mode != Mode::Standalone) {
    HeaderValuesSetOperation *op;
    if (mode == Mode::ProxyToRequest)
      op = (HeaderValuesSetOperation *)xqd_req_header_insert;
    else
      op = (HeaderValuesSetOperation *)xqd_resp_header_insert;
    if (!HANDLE_RESULT(cx, op(detail::handle(self), name_chars.get(), name_len, value_chars.get(),
                              value_len))) {
      return false;
    }
  }

  RootedObject map(cx, detail::backing_map(self));
  if (!JS::MapSet(cx, map, normalized_name, normalized_value))
    return false;

  args.rval().setUndefined();
  return true;
}
bool set(JSContext *cx, unsigned argc, Value *vp) {
  METHOD_HEADER(2)

  NORMALIZE_NAME(args[0], "Headers.set")
  NORMALIZE_VALUE(args[1], "Headers.set")

  Mode mode = detail::mode(self);
  if (mode != Mode::Standalone) {
    HeaderValuesSetOperation *op;
    if (mode == Mode::ProxyToRequest)
      op = (HeaderValuesSetOperation *)xqd_req_header_insert;
    else
      op = (HeaderValuesSetOperation *)xqd_resp_header_insert;
    if (!HANDLE_RESULT(cx, op(detail::handle(self), name_chars.get(), name_len, value_chars.get(),
                              value_len))) {
      return false;
    }
  }

  RootedObject map(cx, detail::backing_map(self));
  if (!JS::MapSet(cx, map, normalized_name, normalized_value))
    return false;

  args.rval().setUndefined();
  return true;
}