import { findLang } from "@/constants/languages"

import type { NextRequest } from "next/server"

export function getDefaultRequestHeaders(request: NextRequest) {
  const lang = findLang(request.nextUrl.pathname)!

  const headers = new Headers(request.headers)
  headers.set("x-lang", lang)
  headers.set("x-pathname", request.nextUrl.pathname.replace(`/${lang}`, ""))
  headers.set("x-url", request.nextUrl.href)

  return headers
}
