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

feat: Capture redirected assets #349

Merged
merged 7 commits into from
Sep 19, 2019
Merged

Conversation

Robdel12
Copy link
Contributor

@Robdel12 Robdel12 commented Sep 19, 2019

What is this?

This PR introduces the ability to capture assets that are discovered, but have a redirect chain. Currently agent will skip these assets since it's not super easy to follow the chain all the way through and then capture that asset in Puppeteer.

Approach

The redirected resources are captured by requesting the redirected URL with axios from Node. This will properly follow the redirect chain for us, then we save the response body of that request as the original request URL (so it proxy's correctly in our rendering env).

While doing this I refactored the methods for capturing resources to their respective paths now. Normal assets from the asset discovery service using puppeteer now process their resource and redirected resources are not processed via Node.

TODOs

axios will follow the redirect chain for us, so we can just request the asset
and get the content back. Then save that content with the original requests URL.
src/services/response-service.ts Outdated Show resolved Hide resolved
test/integration/agent-integration.test.ts Outdated Show resolved Hide resolved
@wwilsman
Copy link
Contributor

Would this be a feature? Are we fixing redirects, or adding support for redirects?

🤷‍♂

@Robdel12 Robdel12 changed the title fix: Capture redirected assets feat: Capture redirected assets Sep 19, 2019
@Robdel12
Copy link
Contributor Author

I'd say it's a feature tbh. Updated the title 👍

@Robdel12 Robdel12 merged commit aa918cc into master Sep 19, 2019
@delete-merged-branch delete-merged-branch bot deleted the rd/capture-redirect-assets branch September 19, 2019 21:02
djones pushed a commit that referenced this pull request Sep 19, 2019
# [0.15.0](v0.14.1...v0.15.0) (2019-09-19)

### Features

* Capture redirected assets  ([#349](#349)) ([aa918cc](aa918cc))
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