Repository navigation
Document the sanitized Sandbox body.html and the X-Blocked-Content header - #63
Conversation
body.html returns the HTML that the Sandbox preview shows, not the email as it was sent. Describe the changes, point to body.htmlsource for the original, and document the X-Blocked-Content response header. Generate the body.html example from the sanitizer output for the body.htmlsource example, so the two examples show the same email. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Motivation
The Sandbox
body.htmlendpoint will return the HTML that the Sandbox preview shows, not the email as it was sent. Mailtrap sanitizes it for preview: scripts and stylesheet links are removed,@importrules are disabled, and entities are escaped. A test that reads a link frombody.htmlgets...?token=abc&user=1instead of...?token=abc&user=1.The spec still says "formatted HTML email body", and its example is the same document as the
body.htmlsourceexample. A newX-Blocked-Contentresponse header reports what the sanitizer removed, and the spec does not document it.Merge this PR when the sanitized response goes live, not before.
Changes
body.html: describe the sanitized responsescript-src 'none'CSP meta tag first inhead&becomes&)@importrenamed to@x-importtarget="_blank"andrel="noopener noreferrer"200with a placeholder page andX-Blocked-Content: unparseable=1body.html: point tobody.htmlsourcefor the email as it was sent, for example to read links in testsbody.html: add theX-Blocked-Contentheader, which holds comma-separatedtype=countpairs with the typesscript,stylesheet,css_importandunparseablecss_importis an upper bound: it counts every disabled@import, also one under a media query and one that the browser ignoresbody.html: replace the example with the real sanitizer output for thebody.htmlsourceexamplebody.htmlsource: add a confirm link with a raw&, a stylesheet link, an external script and an@importto the example, so the two examples show the same email before and after sanitizing; describe it as the HTML body as it was sentHow to test
body.htmlsource, and theX-Blocked-Contentheader on the200responsebody.htmlexample, the confirm link has&and the@importis@x-import; in thebody.htmlsourceexample, they are as sentnpx @redocly/cli lint specs/sandbox.openapi.ymlreports no new problems compared tomain🤖 Generated with Claude Code
Summary by CodeRabbit