@netlify/functions
Advanced tools
Comparing version 0.7.3-streaming.9 to 0.7.3-streaming.10
@@ -5,3 +5,3 @@ { | ||
"types": "./src/main.d.ts", | ||
"version": "0.7.3-streaming.9", | ||
"version": "0.7.3-streaming.10", | ||
"description": "JavaScript utilities for Netlify Functions", | ||
@@ -8,0 +8,0 @@ "files": [ |
/* eslint-disable no-underscore-dangle , promise/prefer-await-to-callbacks, */ | ||
// @ts-check | ||
const { Buffer } = require('buffer') | ||
const http = require('http') | ||
@@ -14,3 +15,2 @@ const https = require('https') | ||
outgoingMessage | ||
METADATA_BOUNDARY = `___x_nf-metadata_boundary-${Date.now()}` | ||
@@ -33,3 +33,2 @@ constructor(url, ip) { | ||
this.outgoingMessage = parsedUrl.protocol === 'https:' ? https.request(url, options) : http.request(url, options) | ||
this.outgoingMessage.setHeader('x-nf-metadata-boundary', this.METADATA_BOUNDARY) | ||
this.pipe(this.outgoingMessage) | ||
@@ -47,7 +46,12 @@ } | ||
_getMetadata() { | ||
return `${JSON.stringify({ | ||
// eslint-disable-next-line node/no-unsupported-features/es-builtins | ||
headers: Object.fromEntries(this._clientHeaders.entries()), | ||
statusCode: this.statusCode, | ||
})}\r\n${this.METADATA_BOUNDARY}` | ||
return Buffer.concat([ | ||
Buffer.from( | ||
JSON.stringify({ | ||
// eslint-disable-next-line node/no-unsupported-features/es-builtins | ||
headers: Object.fromEntries(this._clientHeaders.entries()), | ||
statusCode: this.statusCode, | ||
}), | ||
), | ||
Uint8Array.from([0x00]), | ||
]) | ||
} | ||
@@ -54,0 +58,0 @@ |
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
291
14562