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

fix: improve mock data redirection for urls w/ matrix parameter #1324

Merged
merged 1 commit into from
May 13, 2024

Conversation

kepek
Copy link
Contributor

@kepek kepek commented Nov 15, 2022

PR Type

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no API changes)
[ ] Build-related changes
[ ] CI-related changes
[ ] Documentation content changes
[ ] Application / infrastructure changes
[ ] Other:

What Is the Current Behavior?

Mocking to potentially personalized resources fails due to the fact that the full request URL is passed as the target point in the Mock Interceptor class.

Setup:

apiMockPaths: ['^products.*/1005182'],

Console Log:

redirecting 'http://localhost:4200/INTERSHOP/rest/WFS/Camfil-CamfilFI-Site/rest;loc=fi_FI;cur=EUR/products;spgid=UEyi3WOuZg2RpGp_3Xqb4c3l0000/1005182' to './assets/mock-data/products;spgid=UEyi3WOuZg2RpGp_3Xqb4c3l0000/1005182/get.json'`

Response:

Request URL: http://localhost:4200/assets/mock-data/products/1005182/get.json?allImages=true
Request Method: GET
Status Code: 404 Not Found

Issue Number: N/A

What Is the New Behavior?

Mocking to potentially personalized resources simply skips all the matrix parameters when creating a new target URL string.

Setup:

apiMockPaths: ['^products.*/1005182'],

Console Log:

redirecting 'http://localhost:4200/INTERSHOP/rest/WFS/Camfil-CamfilFI-Site/rest;loc=fi_FI;cur=EUR/products;spgid=UEyi3WOuZg2RpGp_3Xqb4c3l0000/1005182' to '/assets/mock-data/products/1005182/get.json'

Response:

Request URL: http://localhost:4200/assets/mock-data/products/1005182/get.json?allImages=true
Request Method: GET
Status Code: 304 OK

Does this PR Introduce a Breaking Change?

[ ] Yes
[x] No

Other Information

N/A

@kepek kepek force-pushed the fix/mock-data-redirection branch 2 times, most recently from 38d048d to 3d819e7 Compare November 16, 2022 10:15
@shauke shauke self-assigned this Nov 21, 2022
* matrix parameters will be removed from the redirect URL
@shauke shauke force-pushed the fix/mock-data-redirection branch from 3d819e7 to b9e2532 Compare May 10, 2024 12:06
@shauke shauke added this to the 5.2 milestone May 10, 2024
@shauke shauke merged commit db448ae into intershop:develop May 13, 2024
21 of 22 checks passed
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.

3 participants