@ardatan/graphql-helix
Advanced tools
Comparing version 0.0.11 to 0.1.12
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getErrorResponse = exports.getPushResponse = exports.getMultipartResponse = exports.getRegularResponse = exports.DEFAULT_TRANSFORM_RESULT_FN = void 0; | ||
const calculate_byte_length_1 = require("./calculate-byte-length"); | ||
const cross_undici_fetch_1 = require("cross-undici-fetch"); | ||
const encode_string_1 = require("./encode-string"); | ||
const DEFAULT_TRANSFORM_RESULT_FN = (result) => result; | ||
@@ -11,6 +11,6 @@ exports.DEFAULT_TRANSFORM_RESULT_FN = DEFAULT_TRANSFORM_RESULT_FN; | ||
const responseBody = JSON.stringify(transformedResult); | ||
const contentLength = (0, calculate_byte_length_1.calculateByteLength)(responseBody); | ||
const decodedString = (0, encode_string_1.encodeString)(responseBody); | ||
const headersInit = { | ||
"Content-Type": "application/json", | ||
"Content-Length": contentLength.toString(), | ||
"Content-Length": decodedString.byteLength.toString(), | ||
}; | ||
@@ -21,3 +21,3 @@ const responseInit = { | ||
}; | ||
return new cross_undici_fetch_1.Response(responseBody, responseInit); | ||
return new cross_undici_fetch_1.Response(decodedString, responseInit); | ||
} | ||
@@ -52,14 +52,11 @@ exports.getRegularResponse = getRegularResponse; | ||
const chunk = JSON.stringify(transformedResult); | ||
const contentLength = (0, calculate_byte_length_1.calculateByteLength)(chunk); | ||
const data = [ | ||
"", | ||
"Content-Type: application/json; charset=utf-8", | ||
"Content-Length: " + contentLength.toString(), | ||
"", | ||
chunk, | ||
]; | ||
const encodedChunk = (0, encode_string_1.encodeString)(chunk); | ||
controller.enqueue('\r\n'); | ||
controller.enqueue('Content-Type: application/json; charset=utf-8\r\n'); | ||
controller.enqueue('Content-Length: ' + encodedChunk.byteLength + '\r\n'); | ||
controller.enqueue('\r\n'); | ||
controller.enqueue(encodedChunk); | ||
if (value.hasNext) { | ||
data.push("---"); | ||
controller.enqueue("\r\n---"); | ||
} | ||
controller.enqueue(data.join("\r\n")); | ||
} | ||
@@ -66,0 +63,0 @@ }, |
{ | ||
"name": "@ardatan/graphql-helix", | ||
"version": "0.0.11", | ||
"version": "0.1.12", | ||
"description": "A highly evolved GraphQL HTTP Server 🧬", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
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
2322677
51
10166