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

Created new endpoint for loading test pages in an iframe. #7615

Merged
merged 3 commits into from Feb 16, 2017
Merged

Created new endpoint for loading test pages in an iframe. #7615

merged 3 commits into from Feb 16, 2017

Conversation

bradfrizzell
Copy link
Contributor

It is becoming increasingly common to want to run example pages within an iframe. Instead of redoing ever test and making N duplicates, I have added an endpoint to the test server, /iframe/, that allows you to load any page inside of an iframe.

// Nest the response in an iframe.
// Example:
// http://localhost:8000/iframe/examples/ads.amp.max.html
app.use('/iframe/', function(req, res) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess you need to strip out the leading '/iframe/'? you can do that by
also, use app.get instead of app.use

@@ -251,6 +251,16 @@ function proxyToAmpProxy(req, res, minify) {
});
}

// Returns an html blob with an iframe pointing to the provided url.
function nestResponseInIframe(url) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to save space from this rapid growing file, let's just inline this function.

Copy link
Contributor

@lannka lannka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! thanks

@lannka lannka merged commit 3cde677 into ampproject:master Feb 16, 2017
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
…#7615)

* Created new endpoint for loading test pages in an iframe.

* Inlined function

* Changed .use to .get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants