-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[TT-11997] Backend logic for request_headers_rewrite #6306
[TT-11997] Backend logic for request_headers_rewrite #6306
Conversation
API Changes no api changes detected |
PR Description updated to latest commit (46b54fa) |
PR Review 🔍
Code feedback:
|
PR Code Suggestions ✨
|
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
### **User description** See https://tyktech.atlassian.net/browse/TT-11997 for details of the request headers rewrite rules. ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Added tests for request headers rewrite rules in GraphQL middleware. - Integrated request headers rewrite logic into the reverse proxy handler. - Added `RequestHeadersRewrite` to `ReverseProxyParams` struct. - Passed `RequestHeadersRewrite` to the GraphQL engine transport for both v1 and v2. - Implemented logic to apply request headers rewrite rules in the GraphQL engine transport, covering three different rewrite scenarios. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>mw_graphql_test.go</strong><dd><code>Add tests for request headers rewrite rules in GraphQL middleware.</code></dd></summary> <hr> gateway/mw_graphql_test.go <li>Added tests for request headers rewrite rules.<br> <li> Implemented three test cases for different rewrite scenarios.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6306/files#diff-72c11b8efcaceccfbbd87e75565353706443bf56420d3fdba6b5bf5f632f4b33">+137/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>reverse_proxy.go</strong><dd><code>Integrate request headers rewrite logic in reverse proxy handler.</code></dd></summary> <hr> gateway/reverse_proxy.go <li>Integrated request headers rewrite logic into the reverse proxy <br>handler.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6306/files#diff-e6e07722257f7e41691e471185ad6d84fd56dc9e5459526ea32e9a5e8fa1a01b">+8/-7</a> </td> </tr> <tr> <td> <details> <summary><strong>engine.go</strong><dd><code>Add RequestHeadersRewrite to ReverseProxyParams struct.</code> </dd></summary> <hr> internal/graphengine/engine.go - Added `RequestHeadersRewrite` to `ReverseProxyParams` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6306/files#diff-9d1ef4ec1b59d708ed86c7cc348b73bd0b619ef034094b5fbd4b138e11ccde6e">+8/-7</a> </td> </tr> <tr> <td> <details> <summary><strong>graphql_go_tools_v1.go</strong><dd><code>Pass RequestHeadersRewrite to GraphQL engine transport (v1).</code></dd></summary> <hr> internal/graphengine/graphql_go_tools_v1.go - Passed `RequestHeadersRewrite` to the GraphQL engine transport. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6306/files#diff-e592cc8ca6ac39e7574765d7f2bbf19193f173791a1b0930d4dde7f9412dc882">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>graphql_go_tools_v2.go</strong><dd><code>Pass RequestHeadersRewrite to GraphQL engine transport (v2).</code></dd></summary> <hr> internal/graphengine/graphql_go_tools_v2.go - Passed `RequestHeadersRewrite` to the GraphQL engine transport. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6306/files#diff-2e41b60f046c2947fbedb8fb841b5c3c962798e3ba8211c7144f326436ffabe3">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>transport.go</strong><dd><code>Implement request headers rewrite logic in GraphQL engine transport.</code></dd></summary> <hr> internal/graphengine/transport.go <li>Added logic to apply request headers rewrite rules in the GraphQL <br>engine transport.<br> <li> Implemented three rewrite rules for request headers.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6306/files#diff-564061c9b29366529eb1f6f10fe39671d2ac738a4731ffd2c8b04dcc0a8cd610">+96/-1</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
User description
See https://tyktech.atlassian.net/browse/TT-11997 for details of the request headers rewrite rules.
PR Type
Enhancement, Tests
Description
RequestHeadersRewrite
toReverseProxyParams
struct.RequestHeadersRewrite
to the GraphQL engine transport for both v1 and v2.Changes walkthrough 📝
mw_graphql_test.go
Add tests for request headers rewrite rules in GraphQL middleware.
gateway/mw_graphql_test.go
reverse_proxy.go
Integrate request headers rewrite logic in reverse proxy handler.
gateway/reverse_proxy.go
handler.
engine.go
Add RequestHeadersRewrite to ReverseProxyParams struct.
internal/graphengine/engine.go
RequestHeadersRewrite
toReverseProxyParams
struct.graphql_go_tools_v1.go
Pass RequestHeadersRewrite to GraphQL engine transport (v1).
internal/graphengine/graphql_go_tools_v1.go
RequestHeadersRewrite
to the GraphQL engine transport.graphql_go_tools_v2.go
Pass RequestHeadersRewrite to GraphQL engine transport (v2).
internal/graphengine/graphql_go_tools_v2.go
RequestHeadersRewrite
to the GraphQL engine transport.transport.go
Implement request headers rewrite logic in GraphQL engine transport.
internal/graphengine/transport.go
engine transport.