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

CIF-2097 - Consume the configured custom HTTP headers in MagentoGraphqlClient #596

Merged
merged 10 commits into from
Jun 17, 2021

Conversation

dplaton
Copy link
Contributor

@dplaton dplaton commented Jun 16, 2021

Description

Users may configure additional HTTP headers to be sent with each Graphql request, via the CIF HTTP Custom Headers configuration service and the cloud service configuration. This PR updates the MagentoGraphqlClient to consume custom HTTP headers from the CA config.

Related Issue

CIF-2097

Motivation and Context

Allow the components to consume the custom HTTP headers.

How Has This Been Tested?

Unit testing, functional testing

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

* Update `MagentoGraphqlClient` to consume custom HTTP headers from the CA config
* Add unit tests
@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #596 (46ff8fd) into master (03db3d1) will increase coverage by 0.00%.
The diff coverage is 86.66%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #596   +/-   ##
=========================================
  Coverage     87.90%   87.90%           
- Complexity     1363     1372    +9     
=========================================
  Files           249      250    +1     
  Lines          6410     6435   +25     
  Branches        961      964    +3     
=========================================
+ Hits           5635     5657   +22     
- Misses          580      583    +3     
  Partials        195      195           
Flag Coverage Δ
integration 64.00% <26.92%> (-0.30%) ⬇️
jest 85.34% <0.00%> (ø)
karma 94.83% <100.00%> (+<0.01%) ⬆️
unittests 87.09% <88.46%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
react-components/src/components/App/app.js 12.50% <0.00%> (ø)
react-components/src/context/ConfigContext.js 100.00% <ø> (ø)
...1/storeconfigexporter/StoreConfigExporterImpl.java 83.33% <62.50%> (-7.58%) ⬇️
...erce/core/components/client/DeniedHttpHeaders.java 100.00% <100.00%> (ø)
...e/core/components/client/MagentoGraphqlClient.java 91.17% <100.00%> (+1.52%) ⬆️
...ore/cif/clientlibs/common/js/CommerceGraphqlApi.js 83.33% <100.00%> (+0.35%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03db3d1...46ff8fd. Read the comment docs.

* Filter the configured custom HTTP headers
* Fix the unit test (also found a bug in it)
@dplaton
Copy link
Contributor Author

dplaton commented Jun 16, 2021

@dplaton @mhaack should this be added to the client-side components via [0][1][2] as well?

I updated the StoreConfigExporter now, I'll update the components soon.

@dplaton dplaton closed this Jun 16, 2021
@dplaton dplaton reopened this Jun 16, 2021
* Update the StoreConfigExporter to expose the configured HTTP headers
* Update unit-tests
Daniel Platon added 2 commits June 17, 2021 16:28
* Update the React components to use the supplied custom headers
* Change the way the headers are exported from the StoreConfigExporterImpl - they are now exported as a JSON string.
Daniel Platon added 2 commits June 17, 2021 16:58
- remove debug logging
- ensure that the `getHttpHeaders` method returns a consistent result even in case of failure
- add the `getHttpHeaders` method to the interface as well
- increase the version in the package-info
Daniel Platon added 2 commits June 17, 2021 18:13
- Consume the custom HTTP headers from the CommerceGraphqlApi.js client library
@herzog31 herzog31 added enhancement New feature or request verified labels Jun 17, 2021
@herzog31 herzog31 merged commit a5de813 into master Jun 17, 2021
@herzog31 herzog31 deleted the features/CIF-2097 branch June 17, 2021 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request verified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants