code: def read_current_user(
      credentials: Optional[HTTPBasicCredentials] = Security(security),
  ):
      if credentials is None:
          return {"msg": "Create an account first"}
      return {
          "username": credentials.username,
          "password": credentials.password,
      }
  
file_path: fastapi/tests/test_security_http_basic_optional.py
imports: from base64 import b64encode
  from typing import Optional
  from fastapi import FastAPI, Security
  from fastapi.security import HTTPBasic, HTTPBasicCredentials
  from fastapi.testclient import TestClient
label_desc: Use image node_id 1 for calling a global function with example usage: read_current_user(credentials) and returns: dict, dict