Skip to content

add JSON API endpoint support to prevent: Content Type Conversion #14

Description

@ankitsejwal

Pgweb only accepts form data, forcing us for JSON→form conversion

// Convert JSON body to form data for pgweb compatibility
  const formData = new URLSearchParams()
  Object.entries(req.body || {}).forEach(([key, value]) => {
    formData.append(key, String(value))
  })
  fetchOptions.body = formData.toString()
  fetchOptions.headers['Content-Type'] =
  'application/x-www-form-urlencoded'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions