@ibm-cloud/cloudant
Version:
IBM Cloudant Node.js SDK
37 lines • 1.61 kB
JavaScript
/**
* © Copyright IBM Corporation 2020, 2022. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSdkHeaders = getSdkHeaders;
const node_os_1 = require("node:os");
const package_json_1 = require("../package.json");
/**
* Get the request headers to be sent in requests by the SDK.
*/
function getSdkHeaders(serviceName, serviceVersion, operationId) {
const sdkName = 'cloudant-node-sdk';
const sdkVersion = package_json_1.version;
const osName = (0, node_os_1.platform)();
const osVersion = (0, node_os_1.release)();
const osArch = (0, node_os_1.arch)();
const nodeVersion = process.version;
const headers = {
'User-Agent': `${sdkName}/${sdkVersion} (node.version=${nodeVersion}; os.name=${osName}; os.version=${osVersion}; os.arch=${osArch}; lang=Node.js;)`,
'X-IBMCloud-SDK-Analytics': `service_name=${serviceName};service_version=${serviceVersion};operation_id=${operationId}`,
};
return headers;
}
//# sourceMappingURL=common.js.map
;