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

New controller middleware handler #14

Merged
merged 2 commits into from
Sep 14, 2020

Conversation

dandwal
Copy link
Contributor

@dandwal dandwal commented Sep 9, 2020

What

A new middleware handler has been added for frontend controller usage.
This middleware ensures that language is always set (defaults if not set) and will log warnings if Florence Access Tokens or Collection IDs are not present.

How to review

This can be seen working here: ONSdigital/dp-frontend-homepage-controller#43 on the homepage controller. Note that the PR is failing due to the need of this dp-net PR needing to be pulled into develep, which will happen once this is approved.

Check the tests give full coverage to new code. Ensure that this won't break anything

How to use

  1. From an app create an implementation of ControllerHandlerFunc.
  2. Call ControllerHandler passing in the implementation of ControllerHandlerFunc
  3. Magic to occur
  4. Note how localeCode, Florence Access token and Collection ID headers are all set.

Who can review

Anyone who is comfortable with middleware and GO

@dandwal dandwal added the enhancement New feature or request label Sep 9, 2020
@dandwal dandwal force-pushed the feature/frontend-controller-middleware branch from a608eaf to 3eee78c Compare September 11, 2020 09:29
- GetCollectionID function now exists
- getCollectionIDFromCookie function now exists
- GetFlorenceToken function now exported
- Update tests to reflect actual behaviour
@dandwal dandwal force-pushed the feature/frontend-controller-middleware branch from 9199d1d to 4debb19 Compare September 14, 2020 06:55
@dandwal dandwal merged commit 5632e25 into master Sep 14, 2020
@dandwal dandwal deleted the feature/frontend-controller-middleware branch September 14, 2020 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants