Skip to content

Plug to allow electric headers #26

@evanob

Description

@evanob

Problem

MissingHeadersError: The response for the shape request to ... didn't include the following required headers:
- electric-offset
- electric-handle
- electric-schema

Proposal

This problem is mentioned in the troubleshooting section of the docs, but it might be nice to include a Plug to easily allow these headers.

I'd be happy to make a PR.

defmodule PhoenixSync.Plugs.ExposeElectricHeaders do
  @behaviour Plug

  @electric_headers ~w[
    electric-cursor
    electric-handle
    electric-offset
    electric-schema
    electric-server
    electric-up-to-date
  ]

  @impl true
  def init(opts), do: opts

  @impl true
  def call(conn, _) do
    Plug.Conn.put_resp_header(
      conn,
      "access-control-expose-headers",
      Enum.join(@electric_headers, ", ")
    )
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy