@sap-ux/fe-mockserver-core
Advanced tools
Comparing version 1.1.90 to 1.1.91
@@ -121,4 +121,4 @@ "use strict"; | ||
this.currentUUID = uuid; | ||
odataRequest.addResponseHeader('sap-contextid', 'SID:ANON:' + uuid); | ||
odataRequest.addResponseHeader('sap-http-session-timeout', this.sessionTimeoutTime.toString()); | ||
odataRequest.addResponseHeader('sap-contextid', 'SID:ANON:' + uuid, true); | ||
odataRequest.addResponseHeader('sap-http-session-timeout', this.sessionTimeoutTime.toString(), true); | ||
} | ||
@@ -125,0 +125,0 @@ performGET(keyValues, asArray, tenantId, odataRequest, dontClone = false) { |
@@ -44,2 +44,3 @@ /// <reference types="node" /> | ||
responseHeaders: Record<string, string>; | ||
globalResponseHeaders: Record<string, string>; | ||
statusCode: number; | ||
@@ -74,3 +75,3 @@ dataCount: number; | ||
addCustomMessage(messageData: any): void; | ||
addResponseHeader(headerName: string, headerValue: string): void; | ||
addResponseHeader(headerName: string, headerValue: string, globalHeader?: boolean): void; | ||
addResponseAnnotation(annotationName: string, annotationValue: any): void; | ||
@@ -77,0 +78,0 @@ setDataCount(dataCount: number): void; |
@@ -20,2 +20,3 @@ "use strict"; | ||
this.responseHeaders = {}; | ||
this.globalResponseHeaders = {}; | ||
this.statusCode = 200; | ||
@@ -449,4 +450,9 @@ this.responseAnnotations = {}; | ||
} | ||
addResponseHeader(headerName, headerValue) { | ||
this.responseHeaders[headerName] = headerValue; | ||
addResponseHeader(headerName, headerValue, globalHeader = false) { | ||
if (globalHeader) { | ||
this.globalResponseHeaders[headerName] = headerValue; | ||
} | ||
else { | ||
this.responseHeaders[headerName] = headerValue; | ||
} | ||
} | ||
@@ -453,0 +459,0 @@ addResponseAnnotation(annotationName, annotationValue) { |
@@ -38,3 +38,3 @@ "use strict"; | ||
const NL = '\r\n'; | ||
async function handlePart(partDefinition, dataAccess, boundary, tenantId) { | ||
async function handlePart(partDefinition, dataAccess, boundary, tenantId, globalHeaders) { | ||
const partRequest = new odataRequest_1.default({ ...partDefinition, tenantId: tenantId }, dataAccess); | ||
@@ -55,2 +55,5 @@ await partRequest.handleRequest(); | ||
} | ||
for (const headerName in partRequest.globalResponseHeaders) { | ||
globalHeaders[headerName] = partRequest.globalResponseHeaders[headerName]; | ||
} | ||
batchResponse += NL; // End of part header | ||
@@ -75,2 +78,3 @@ if (responseData) { | ||
const batchData = (0, batchParser_1.parseBatch)(new batchParser_1.BatchContent(body), boundary); | ||
const globalHeaders = {}; | ||
let batchResponse = ''; | ||
@@ -83,3 +87,3 @@ for (const part of batchData.parts) { | ||
for (const changeSetPart of part.parts) { | ||
batchResponse += await handlePart(changeSetPart, dataAccess, part.boundary, req.tenantId); | ||
batchResponse += await handlePart(changeSetPart, dataAccess, part.boundary, req.tenantId, globalHeaders); | ||
} | ||
@@ -89,3 +93,3 @@ batchResponse += `--${part.boundary}--${NL}`; | ||
else { | ||
batchResponse += await handlePart(part, dataAccess, batchData.boundary, req.tenantId); | ||
batchResponse += await handlePart(part, dataAccess, batchData.boundary, req.tenantId, globalHeaders); | ||
} | ||
@@ -95,2 +99,5 @@ } | ||
res.statusCode = 200; | ||
for (const globalHeaderName in globalHeaders) { | ||
res.setHeader(globalHeaderName, globalHeaders[globalHeaderName]); | ||
} | ||
res.setHeader('Content-Type', `multipart/mixed; boundary=${batchData.boundary}`); | ||
@@ -97,0 +104,0 @@ res.setHeader('odata-version', dataAccess.getMetadata().getVersion()); |
{ | ||
"name": "@sap-ux/fe-mockserver-core", | ||
"version": "1.1.90", | ||
"version": "1.1.91", | ||
"description": "SAP Fiori OData - Fiori elements mock server core", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
548349
6330