This repository was archived by the owner on Jul 9, 2022. It is now read-only.
feat: implement custom PLug to forward headers using a Absinthe.Plug#5
Open
frfroes wants to merge 3 commits intoSpiffInc:mainfrom
Open
feat: implement custom PLug to forward headers using a Absinthe.Plug#5frfroes wants to merge 3 commits intoSpiffInc:mainfrom
frfroes wants to merge 3 commits intoSpiffInc:mainfrom
Conversation
feliperenan
reviewed
Jan 25, 2021
feliperenan
reviewed
Jan 25, 2021
feliperenan
reviewed
Jan 25, 2021
feliperenan
reviewed
Jan 25, 2021
feliperenan
reviewed
Jan 25, 2021
feliperenan
reviewed
Jan 25, 2021
feliperenan
reviewed
Jan 25, 2021
| defmodule Absinthe.Compose.Plug.ForwardHeader do | ||
| @moduledoc """ | ||
| This Plug takes the given headers and add it to Absinthe.Plug context in order to be fowarded | ||
| on to the Upstream service on the resolver level. |
Contributor
There was a problem hiding this comment.
If we proceed with this approach, I think it would be nice if we add how users of this library would plug this plug on their application. It could be here though, something like this:
@moduledoc """
omitted...
In order to use this plug, you need to plug this in your router.
pipeline :my_pipeline do
plug Absinthe.Compose.Plug.ForwardHeader, ["authorization"]
end
"""
Contributor
There was a problem hiding this comment.
Btw, I think would be better if we specify a key for the headers name, something like: plug Absinthe.Compose.Plug.ForwardHeader, headers: ["authorization"]
My main concern is if this plug starts to receive new arguments in the future (I don't have an example of that). If that happens, a new release of this library would result in a breaking change, requiring all users of this library to update their code before proceeding with the update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR closes #4
I implemented the solution described in the issue by @feliperenan where we have a custom
Plugthat takes the given headers from theconnand inject it into theAbsinthe.Plugcontext in other to forward them to the downstream services on the resolver level.