next-aws-cloudfront
Advanced tools
Comparing version 1.3.1-alpha.0 to 1.3.1-alpha.1
@@ -79,3 +79,3 @@ const create = require("../next-aws-cloudfront"); | ||
it("duplicates of special request headers are discarded", () => { | ||
SPECIAL_NODE_HEADERS.forEach(headerName => { | ||
SPECIAL_NODE_HEADERS.forEach((headerName) => { | ||
// user-agent -> uSER-AGENT | ||
@@ -119,3 +119,3 @@ const duplicateHeaderName = | ||
it("text body", done => { | ||
it("text body", (done) => { | ||
const { req } = create({ | ||
@@ -132,3 +132,3 @@ request: { | ||
req.on("data", chunk => { | ||
req.on("data", (chunk) => { | ||
data += chunk; | ||
@@ -143,3 +143,3 @@ }); | ||
it("text base64 body", done => { | ||
it("text base64 body", (done) => { | ||
const { req } = create({ | ||
@@ -158,3 +158,3 @@ request: { | ||
req.on("data", chunk => { | ||
req.on("data", (chunk) => { | ||
data += chunk; | ||
@@ -169,3 +169,3 @@ }); | ||
it("text body with encoding", done => { | ||
it("text body with encoding", (done) => { | ||
const { req } = create({ | ||
@@ -183,3 +183,3 @@ request: { | ||
req.on("data", chunk => { | ||
req.on("data", (chunk) => { | ||
data += chunk; | ||
@@ -194,3 +194,3 @@ }); | ||
it("connection", done => { | ||
it("connection", (done) => { | ||
const { req } = create({ | ||
@@ -221,3 +221,3 @@ request: { | ||
it("request preserve http.IncomingMessage.prototype function", () => { | ||
const exampleFunction = function() { | ||
const exampleFunction = function () { | ||
return "I'm an example function."; | ||
@@ -224,0 +224,0 @@ }; |
@@ -18,3 +18,3 @@ const zlib = require("zlib"); | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.status).toEqual(404); | ||
@@ -37,3 +37,3 @@ }); | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.status).toEqual(200); | ||
@@ -56,3 +56,3 @@ expect(response.statusDescription).toEqual("OK"); | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.status).toEqual(200); | ||
@@ -78,3 +78,3 @@ }); | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.headers).toEqual({ | ||
@@ -121,3 +121,3 @@ "x-custom-1": [ | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.headers).toEqual({}); | ||
@@ -138,3 +138,3 @@ }); | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.headers).toEqual({ | ||
@@ -167,3 +167,3 @@ "set-cookie": [ | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.headers).toEqual({ | ||
@@ -198,3 +198,3 @@ "x-custom-1": [ | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.headers).toEqual({ | ||
@@ -224,3 +224,3 @@ "x-custom-2": [ | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.headers).toEqual({ | ||
@@ -307,3 +307,3 @@ "x-custom-2": [ | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.body).toEqual("b2s="); | ||
@@ -326,3 +326,3 @@ expect(response.bodyEncoding).toEqual("base64"); | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.body).toEqual("b2s="); | ||
@@ -356,3 +356,3 @@ }); | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.headers["content-encoding"]).toEqual([ | ||
@@ -378,3 +378,3 @@ { key: "Content-Encoding", value: "gzip" } | ||
return responsePromise.then(response => { | ||
return responsePromise.then((response) => { | ||
expect(response.body).not.toBeDefined(); | ||
@@ -381,0 +381,0 @@ expect(response.bodyEncoding).not.toBeDefined(); |
@@ -6,2 +6,8 @@ # Change Log | ||
## [1.3.1-alpha.1](https://github.com/danielcondemarin/serverless-next.js/compare/next-aws-cloudfront@1.3.1-alpha.0...next-aws-cloudfront@1.3.1-alpha.1) (2020-06-24) | ||
### Bug Fixes | ||
- **serverless-component:** don't overwrite the cloudfront default.forward config ([#460](https://github.com/danielcondemarin/serverless-next.js/issues/460)) ([12da1de](https://github.com/danielcondemarin/serverless-next.js/commit/12da1de31855b68b9addef801ec21dffd3202a21)) | ||
## [1.3.1-alpha.0](https://github.com/danielcondemarin/serverless-next.js/compare/next-aws-cloudfront@1.3.0...next-aws-cloudfront@1.3.1-alpha.0) (2020-06-21) | ||
@@ -8,0 +14,0 @@ |
@@ -93,6 +93,6 @@ const Stream = require("stream"); | ||
const toCloudFrontHeaders = headers => { | ||
const toCloudFrontHeaders = (headers) => { | ||
const result = {}; | ||
Object.keys(headers).forEach(headerName => { | ||
Object.keys(headers).forEach((headerName) => { | ||
const lowerCaseHeaderName = headerName.toLowerCase(); | ||
@@ -108,3 +108,3 @@ const headerValue = headers[headerName]; | ||
if (headerValue instanceof Array) { | ||
headerValue.forEach(val => { | ||
headerValue.forEach((val) => { | ||
result[lowerCaseHeaderName].push({ | ||
@@ -126,3 +126,3 @@ key: headerName, | ||
const isGzipSupported = headers => { | ||
const isGzipSupported = (headers) => { | ||
let gz = false; | ||
@@ -133,3 +133,3 @@ const ae = headers["accept-encoding"]; | ||
const { value } = ae[i]; | ||
const bits = value.split(",").map(x => x.split(";")[0].trim()); | ||
const bits = value.split(",").map((x) => x.split(";")[0].trim()); | ||
if (bits.indexOf("gzip") !== -1) { | ||
@@ -143,3 +143,3 @@ gz = true; | ||
const handler = event => { | ||
const handler = (event) => { | ||
const { request: cfRequest } = event; | ||
@@ -168,3 +168,3 @@ | ||
headerKeyValPairs.forEach(keyVal => { | ||
headerKeyValPairs.forEach((keyVal) => { | ||
req.rawHeaders.push(keyVal.key); | ||
@@ -177,3 +177,3 @@ req.rawHeaders.push(keyVal.value); | ||
req.getHeader = name => { | ||
req.getHeader = (name) => { | ||
return req.headers[name.toLowerCase()]; | ||
@@ -216,3 +216,3 @@ }; | ||
}; | ||
res.write = chunk => { | ||
res.write = (chunk) => { | ||
if (!response.body) { | ||
@@ -230,4 +230,4 @@ response.body = Buffer.from(""); | ||
const responsePromise = new Promise(resolve => { | ||
res.end = text => { | ||
const responsePromise = new Promise((resolve) => { | ||
res.end = (text) => { | ||
if (text) res.write(text); | ||
@@ -262,6 +262,6 @@ | ||
}; | ||
res.removeHeader = name => { | ||
res.removeHeader = (name) => { | ||
delete res.headers[name.toLowerCase()]; | ||
}; | ||
res.getHeader = name => { | ||
res.getHeader = (name) => { | ||
return res.headers[name.toLowerCase()]; | ||
@@ -272,3 +272,3 @@ }; | ||
}; | ||
res.hasHeader = name => { | ||
res.hasHeader = (name) => { | ||
return !!res.getHeader(name); | ||
@@ -275,0 +275,0 @@ }; |
{ | ||
"name": "next-aws-cloudfront", | ||
"version": "1.3.1-alpha.0", | ||
"version": "1.3.1-alpha.1", | ||
"description": "Compat layer for running next.js apps in Lambda@Edge", | ||
@@ -27,3 +27,3 @@ "main": "next-aws-cloudfront.js", | ||
}, | ||
"gitHead": "e37c725ffbab01cb29471f7bd1cfcfd08dbdc759" | ||
"gitHead": "ad81638944ec7b43d24b7121336bb7c8311073f0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25277