badmagic icon indicating copy to clipboard operation
badmagic copied to clipboard

ENG: Add HTML Response View

Open tscritch opened this issue 3 years ago • 5 comments

Description

Found reading the raw html particularly frustrating when creating new routes and you have error responses from Phoenix which are unreadable. I was copying the text to a file to view in the browser but this is much faster 😄

This adds an option to view a rendered html response for a route. It also adds a basic local test server for development.

The response is not rendered by default and it is rendered in an iframe for sandboxing.

Steps to test

  1. Follow steps in README.md to setup the local example folder.
  2. Go to http://localhost:3005.
  3. Try the /views/breeds.html route.
  4. Observe raw response.
  5. Click "Render HTML" button.
  6. Observe rendered response.

Screenshots

html-preview

tscritch avatar Nov 16 '21 16:11 tscritch

Thanks for rendering this in an iframe! That was going to be my one request.

matthew-kerle avatar Nov 16 '21 16:11 matthew-kerle

Screen Shot 2021-12-12 at 12 51 31 PM

I'm having trouble getting this to work when testing locally. When testing, I see a valid html response on the route I'm hitting but when I click "Render HTML", I see the above. 🤔

I can send more details over Slack if helpful.

jwdotjs avatar Dec 12 '21 19:12 jwdotjs

I am seeing this work for me again 🚀 Screen Shot 2022-02-24 at 12 04 43 PM

tscritch avatar Feb 24 '22 18:02 tscritch

Just wanted to post an update posted in Slack. This should be not crashing now. This is a video of testing with a bad route in CMW: Screen-Recording-2022-04-06-at-11 22 20-AM

tscritch avatar Apr 11 '22 19:04 tscritch

Socket Security Report

Dependency issues detected. If you merge this pull request, you will not be alerted to the instances of these issues again.

📜 New install scripts detected

A dependency change in this PR is introducing new install scripts to your install step.

Package Script field Location
[email protected] (added) binding.gyp example/package.json via [email protected], [email protected]
[email protected] (added) install example/package.json via [email protected], [email protected]
[email protected] (added) postinstall example/package.json via [email protected], [email protected]
🫣 Native code

Contains native code which could be a vector to obscure malicious code, and generally decrease the likelihood of reproducible or reliable installs.

Package Location
[email protected] (added) example/package.json via [email protected], [email protected]
Socket.dev scan summary
Issue Status
Did you mean? ✅ no new possible package typos
Install scripts ⚠️ 3 new install scripts detected
Telemetry ✅ no new telemetry
Troll package ✅ no new troll packages
Malware ✅ no new malware
Native code ⚠️ 1 new native module detected
Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] [email protected]

⚠️ Please accept the latest app permissions to ensure bot commands work properly. Accept the new permissions here.

Powered by socket.dev

socket-security[bot] avatar Oct 07 '22 16:10 socket-security[bot]