Skip to content

Commit

Permalink
Fix proxy for POST body, add viewer render preprocessing to tests (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
fstanis authored Apr 14, 2020
1 parent a2dc9f1 commit 7460192
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/backend/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function fetchParamsFromInit(init) {
headers.set('origin', HOST_ORIGIN);
return {
method: init.method,
body: init.body,
body: init.body ? new URLSearchParams(init.body) : null,
headers,
redirect: 'error',
credentials: 'omit',
Expand Down
1 change: 1 addition & 0 deletions example/frontend/tester/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ window.ampContainerConfig = Object.assign(
imageProxyURL: process.env.CONFIG_IMAGE_PROXY_URL,
xhrProxyURL: process.env.CONFIG_XHR_PROXY_URL,
templateProxyURL: process.env.CONFIG_TEMPLATE_PROXY_URL,
transformTemplateProxyOutput: true,
linkRedirectURL: process.env.CONFIG_LINK_REDIRECT_URL,
loadTimeout: 3000,
},
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"parcel-bundler": "^1.12.4"
},
"scripts": {
"test": "jest --forceExit"
"test": "jest --forceExit --runInBand"
},
"alias": {
"@ampproject/email-viewer": ".."
Expand Down
6 changes: 5 additions & 1 deletion src/framecontainer/rendering-modules/ViewerRenderProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { parseHTMLFragment, serializeHTML, postJSON } from '../../util';
import { transformingModules } from '../../preprocessing/preprocessing-modules/index';
import { Config } from '../../config';

const TEMPLATE_TRANSFORMING_MODULES = ['HyperlinkRewrite', 'ImageURLRewrite'];
const TEMPLATE_TRANSFORMING_MODULES = [
'CSS',
'HyperlinkRewrite',
'ImageURLRewrite',
];

/**
* Proxies XHR requests that include mustache template rendering coming from the
Expand Down
4 changes: 4 additions & 0 deletions src/preprocessing/preprocessing-modules/CSS/whitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ export const ALLOWED_PROPERTIES_WITH_URL = new Set([
]);

export const ALLOWED_PROPERTIES = new Set([
'-moz-appearance',
'-webkit-appearance',
'-webkit-tap-highlight-color',
'align-content',
'align-items',
'align-self',
'appearance',
Expand Down Expand Up @@ -158,6 +160,7 @@ export const ALLOWED_PROPERTIES = new Set([
'font-variant-numeric',
'font-variation-settings',
'font-weight',
'gap',
'grid',
'grid-area',
'grid-auto-columns',
Expand Down Expand Up @@ -231,6 +234,7 @@ export const ALLOWED_PROPERTIES = new Set([
'resize',
'richness',
'right',
'row-gap',
'speak',
'speak-header',
'speak-numeral',
Expand Down

0 comments on commit 7460192

Please sign in to comment.