bool delete_(JSContext *cx, unsigned argc, Value *vp) {
  METHOD_HEADER_WITH_NAME(1, "delete")

  NORMALIZE_NAME(args[0], "Headers.delete")

  bool has;
  RootedObject map(cx, detail::backing_map(self));
  if (!JS::MapDelete(cx, map, normalized_name, &has))
    return false;

  // If no header with the given name exists, `delete` is a no-op.
  if (!has) {
    args.rval().setUndefined();
    return true;
  }

  Mode mode = detail::mode(self);
  if (mode != Mode::Standalone) {
    HeaderRemoveOperation *op;
    if (mode == Mode::ProxyToRequest)
      op = (HeaderRemoveOperation *)xqd_req_header_remove;
    else
      op = (HeaderRemoveOperation *)xqd_resp_header_remove;
    if (!HANDLE_RESULT(cx, op(detail::handle(self), name_chars.get(), name_len)))
      return false;
  }

  args.rval().setUndefined();
  return true;
}
bool delete_(JSContext *cx, unsigned argc, Value *vp) {
  METHOD_HEADER_WITH_NAME(1, "delete")

  NORMALIZE_NAME(args[0], "Headers.delete")

  bool has;
  RootedObject map(cx, detail::backing_map(self));
  if (!JS::MapDelete(cx, map, normalized_name, &has))
    return false;

   
  if (!has) {
    args.rval().setUndefined();
    return true;
  }

  Mode mode = detail::mode(self);
  if (mode != Mode::Standalone) {
    HeaderRemoveOperation *op;
    if (mode == Mode::ProxyToRequest)
      op = (HeaderRemoveOperation *)xqd_req_header_remove;
    else
      op = (HeaderRemoveOperation *)xqd_resp_header_remove;
    if (!HANDLE_RESULT(cx, op(detail::handle(self), name_chars.get(), name_len)))
      return false;
  }

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