Home / Function/ parseHeaders() — supabase Function Reference

parseHeaders() — supabase Function Reference

Architecture documentation for the parseHeaders() function in EditHookPanel.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  968288ae_e3b0_e6e8_fcc6_f65895cdafe9["parseHeaders()"]
  2fd526da_e282_fb5d_bb33_b211accacf07["EditHookPanel()"]
  2fd526da_e282_fb5d_bb33_b211accacf07 -->|calls| 968288ae_e3b0_e6e8_fcc6_f65895cdafe9
  style 968288ae_e3b0_e6e8_fcc6_f65895cdafe9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx lines 43–61

const parseHeaders = (selectedHook?: PostgresTrigger): HTTPArgument[] => {
  if (typeof selectedHook === 'undefined') {
    return [{ id: uuidv4(), name: 'Content-type', value: 'application/json' }]
  }
  const [, , headers] = selectedHook.function_args
  let parsedHeaders: Record<string, string> = {}

  try {
    parsedHeaders = JSON.parse(headers.replace(/\\"/g, '"'))
  } catch (e) {
    parsedHeaders = {}
  }

  return Object.entries(parsedHeaders).map(([name, value]) => ({
    id: uuidv4(),
    name,
    value,
  }))
}

Subdomains

Called By

Frequently Asked Questions

What does parseHeaders() do?
parseHeaders() is a function in the supabase codebase.
What calls parseHeaders()?
parseHeaders() is called by 1 function(s): EditHookPanel.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free