fix(cors): dynamic origin for staging support (BUG-111) + eliminate all 'as any' casts
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 17m51s
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 17m51s
- CORS middleware now allows both docfast.dev and staging.docfast.dev origins for auth/billing routes, with Vary: Origin header for proper caching - Unknown origins fall back to production origin (not reflected) - 13 TDD tests added for CORS behavior Type safety improvements: - Augment Express.Request with requestId, acquirePdfSlot, releasePdfSlot - Use Puppeteer's PaperFormat and PuppeteerLifeCycleEvent types in browser.ts - Use 'as const' for format literals in convert/demo/templates routes - Replace Stripe apiVersion 'as any' with @ts-expect-error - Zero 'as any' casts remaining in production code 579 tests passing (13 new), 51 test files
This commit is contained in:
parent
a60d379e66
commit
da049b77e3
9 changed files with 89 additions and 18 deletions
|
|
@ -97,7 +97,7 @@ interface DemoBody {
|
|||
* 504:
|
||||
* description: PDF generation timed out
|
||||
*/
|
||||
router.post("/html", async (req: Request & { acquirePdfSlot?: () => Promise<void>; releasePdfSlot?: () => void }, res: Response) => {
|
||||
router.post("/html", async (req: Request, res: Response) => {
|
||||
let slotAcquired = false;
|
||||
try {
|
||||
const ct = req.headers["content-type"] || "";
|
||||
|
|
@ -128,7 +128,7 @@ router.post("/html", async (req: Request & { acquirePdfSlot?: () => Promise<void
|
|||
: injectWatermark(wrapHtml(body.html, body.css));
|
||||
|
||||
const defaultOpts = {
|
||||
format: "A4",
|
||||
format: "A4" as const,
|
||||
landscape: false,
|
||||
printBackground: true,
|
||||
margin: { top: "0", right: "0", bottom: "0", left: "0" },
|
||||
|
|
@ -203,7 +203,7 @@ router.post("/html", async (req: Request & { acquirePdfSlot?: () => Promise<void
|
|||
* 504:
|
||||
* description: PDF generation timed out
|
||||
*/
|
||||
router.post("/markdown", async (req: Request & { acquirePdfSlot?: () => Promise<void>; releasePdfSlot?: () => void }, res: Response) => {
|
||||
router.post("/markdown", async (req: Request, res: Response) => {
|
||||
let slotAcquired = false;
|
||||
try {
|
||||
const ct = req.headers["content-type"] || "";
|
||||
|
|
@ -233,7 +233,7 @@ router.post("/markdown", async (req: Request & { acquirePdfSlot?: () => Promise<
|
|||
const fullHtml = injectWatermark(wrapHtml(htmlContent, body.css));
|
||||
|
||||
const defaultOpts = {
|
||||
format: "A4",
|
||||
format: "A4" as const,
|
||||
landscape: false,
|
||||
printBackground: true,
|
||||
margin: { top: "0", right: "0", bottom: "0", left: "0" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue