diff --git a/plugins/techdocs-backend/src/cache/cacheMiddleware.test.ts b/plugins/techdocs-backend/src/cache/cacheMiddleware.test.ts index b6a0f7db56..0a21eddc15 100644 --- a/plugins/techdocs-backend/src/cache/cacheMiddleware.test.ts +++ b/plugins/techdocs-backend/src/cache/cacheMiddleware.test.ts @@ -23,17 +23,20 @@ import { createCacheMiddleware, TechDocsCache } from '.'; * Mocks cached HTTP response. */ const getMockHttpResponseFor = (content: string): Buffer => { - return Buffer.concat([ - Buffer.from(`HTTP/1.1 200 OK -Content-Type: text/plain; charset=utf-8 -Accept-Ranges: bytes -Cache-Control: public, max-age=0 -Last-Modified: Sat, 1 Jul 2021 12:00:00 GMT -Date: Sat, 1 Jul 2021 12:00:00 GMT -Connection: close -Content-Length: ${content.length}\n\n`), - Buffer.from(content), - ]); + return Buffer.from( + [ + 'HTTP/1.1 200 OK', + 'Content-Type: text/plain; charset=utf-8', + 'Accept-Ranges: bytes', + 'Cache-Control: public, max-age=0', + 'Last-Modified: Sat, 1 Jul 2021 12:00:00 GMT', + 'Date: Sat, 1 Jul 2021 12:00:00 GMT', + 'Connection: close', + `Content-Length: ${content.length}`, + '', + content, + ].join('\r\n'), + ); }; /** diff --git a/plugins/techdocs-backend/src/service/router.test.ts b/plugins/techdocs-backend/src/service/router.test.ts index f3f9892f44..9edd2e3edc 100644 --- a/plugins/techdocs-backend/src/service/router.test.ts +++ b/plugins/techdocs-backend/src/service/router.test.ts @@ -56,17 +56,20 @@ const MockTechDocsCache = { TechDocsCache.fromConfig = () => MockTechDocsCache; const getMockHttpResponseFor = (content: string): Buffer => { - return Buffer.concat([ - Buffer.from(`HTTP/1.1 200 OK -Content-Type: text/plain; charset=utf-8 -Accept-Ranges: bytes -Cache-Control: public, max-age=0 -Last-Modified: Sat, 1 Jul 2021 12:00:00 GMT -Date: Sat, 1 Jul 2021 12:00:00 GMT -Connection: close -Content-Length: ${content.length}\n\n`), - Buffer.from(content), - ]); + return Buffer.from( + [ + 'HTTP/1.1 200 OK', + 'Content-Type: text/plain; charset=utf-8', + 'Accept-Ranges: bytes', + 'Cache-Control: public, max-age=0', + 'Last-Modified: Sat, 1 Jul 2021 12:00:00 GMT', + 'Date: Sat, 1 Jul 2021 12:00:00 GMT', + 'Connection: close', + `Content-Length: ${content.length}`, + '', + content, + ].join('\r\n'), + ); }; const createApp = async (options: RouterOptions) => {