From d63bdcbaab5dbafba8696fe848f48a371a39501c Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Sun, 13 Jun 2021 12:34:41 +0200 Subject: [PATCH] Added support for more json type headers --- index.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 81b148f..855ab50 100644 --- a/index.js +++ b/index.js @@ -349,7 +349,7 @@ class Router { }) } const headers = Object.assign({ 'Content-Type': 'application/json' }, response.headers) - if (headers['Content-Type'] === 'application/json' && typeof response.body === 'object') + if (headers['Content-Type'].includes('json') && typeof response.body === 'object') response.body = JSON.stringify(response.body) return new Response(response.body, { status: response.status || (response.body ? 200 : 500), diff --git a/package.json b/package.json index e1b2917..c2a3704 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tsndr/cloudflare-worker-router", - "version": "1.1.1", + "version": "1.1.2", "description": "", "main": "index.js", "scripts": {},