template <auto mode> JSObject *headers(JSContext *cx, HandleObject obj) {
  JSObject *headers = maybe_headers(obj);
  if (!headers) {
    RootedObject headersInstance(
        cx, JS_NewObjectWithGivenProto(cx, &Headers::class_, Headers::proto_obj));
    if (!headersInstance)
      return nullptr;
    headers = Headers::create(cx, headersInstance, mode, obj);
    if (!headers)
      return nullptr;
    JS_SetReservedSlot(obj, Slots::Headers, ObjectValue(*headers));
  }

  return headers;
}
template <auto mode> JSObject *headers(JSContext *cx, HandleObject obj) {
  JSObject *headers = maybe_headers(obj);
  if (!headers) {
    RootedObject headersInstance(
        cx, JS_NewObjectWithGivenProto(cx, &Headers::class_, Headers::proto_obj));
    if (!headersInstance)
      return nullptr;
    headers = Headers::create(cx, headersInstance, mode, obj);
    if (!headers)
      return nullptr;
    JS_SetReservedSlot(obj, Slots::Headers, ObjectValue(*headers));
  }

  return headers;
}