Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy X-headers and status code to the React app #31

Merged
merged 1 commit into from
May 20, 2021

Conversation

MuhammadFarag
Copy link
Contributor

WHY are these changes introduced?

Proxy status code and X-headers to the React App

WHAT is this pull request doing?

  • Filter X-headers and pass it in the response of Proxy

Checklist

  • I have added/updated tests for this change

@MuhammadFarag MuhammadFarag requested a review from a team as a code owner May 20, 2021 15:26
Copy link
Collaborator

@paulomarg paulomarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, but I'd like to get a second opinion on this one as I'm not sure it's good practice 😄 .

routes/web.php Outdated
return response($result->getDecodedBody());
$response = Utils::graphqlProxy($request->header(), $request->cookie(), $request->getContent());

$xHeaders = array_filter($response->getHeaders(), fn( $key) => str_starts_with($key, 'X'), ARRAY_FILTER_USE_KEY);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can ever get lower-case xs here. We should probably cover that just in case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants