Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var httpRequest = new WebResource();
httpRequest.method = 'PUT';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
// Serialize Request
var requestContent = null;
requestContent = JSON.stringify(msRest.serializeObject(booleanValue));
httpRequest.body = requestContent;
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ? requestContent.length : Buffer.byteLength(requestContent, 'UTF8');
// Send Request
return client.pipeline(httpRequest, function (err, response, responseBody) {
if (err) {
return callback(err);
}
var statusCode = response.statusCode;
if (statusCode !== 200) {
var error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = httpRequest;
error.response = response;
if (responseBody === '') responseBody = null;
var parsedErrorResponse;
try {
requestUrl += '?' + queryParameters.join('&');
}
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'PUT';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
// Serialize Request
var requestContent = null;
requestContent = JSON.stringify(msRest.serializeObject(resourceDictionary));
httpRequest.body = requestContent;
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ? requestContent.length : Buffer.byteLength(requestContent, 'UTF8');
// Send Request
return client.pipeline(httpRequest, function (err, response, responseBody) {
if (err) {
return callback(err);
}
var statusCode = response.statusCode;
if (statusCode !== 200) {
var error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = httpRequest;
error.response = response;
if (responseBody === '') responseBody = null;
var parsedErrorResponse;
try {
// Validate
try {
if (dateQuery && !(dateQuery instanceof Date ||
(typeof dateQuery.valueOf() === 'string' && !isNaN(Date.parse(dateQuery))))) {
throw new Error('dateQuery must be of type date.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//queries/date/null';
var queryParameters = [];
if (dateQuery !== null && dateQuery !== undefined) {
queryParameters.push('dateQuery=' + encodeURIComponent(msRest.serializeObject(dateQuery).replace(/[Tt].*[Zz]/, '')));
}
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if(options) {
for(var headerName in options['customHeaders']) {
// Validate
try {
if (dateTimeQuery && !(dateTimeQuery instanceof Date ||
(typeof dateTimeQuery.valueOf() === 'string' && !isNaN(Date.parse(dateTimeQuery))))) {
throw new Error('dateTimeQuery must be of type date.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//queries/datetime/null';
var queryParameters = [];
if (dateTimeQuery !== null && dateTimeQuery !== undefined) {
queryParameters.push('dateTimeQuery=' + encodeURIComponent(msRest.serializeObject(dateTimeQuery)));
}
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if(options) {
for(var headerName in options['customHeaders']) {
try {
if (dateTimeQuery !== null && dateTimeQuery !== undefined &&
!(dateTimeQuery instanceof Date ||
(typeof dateTimeQuery === 'string' && !isNaN(Date.parse(dateTimeQuery))))) {
throw new Error('dateTimeQuery must be of type date.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//queries/datetime/2012-01-01T01%3A01%3A01Z';
var queryParameters = [];
if (dateTimeQuery !== null && dateTimeQuery !== undefined) {
queryParameters.push('dateTimeQuery=' + encodeURIComponent(msRest.serializeObject(dateTimeQuery)));
}
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
httpRequest.body = null;
'//header/param/prim/datetime';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'POST';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (scenario !== null) {
httpRequest.headers['scenario'] = scenario;
}
if (value !== null) {
httpRequest.headers['value'] = msRest.serializeObject(value);
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
httpRequest.body = null;
httpRequest.headers['Content-Length'] = 0;
// Send Request
return client.pipeline(httpRequest, function (err, response, responseBody) {
if (err) {
return callback(err);
}
var httpRequest = new WebResource();
httpRequest.method = 'PUT';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
// Serialize Request
var requestContent = null;
requestContent = JSON.stringify(msRest.serializeObject(numberBody));
httpRequest.body = requestContent;
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ? requestContent.length : Buffer.byteLength(requestContent, 'UTF8');
// Send Request
return client.pipeline(httpRequest, function (err, response, responseBody) {
if (err) {
return callback(err);
}
var statusCode = response.statusCode;
if (statusCode !== 200) {
var error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = httpRequest;
error.response = response;
if (responseBody === '') responseBody = null;
var parsedErrorResponse;
try {
}
// Validate
try {
if (byteQuery !== null && byteQuery !== undefined && !Buffer.isBuffer(byteQuery)) {
throw new Error('byteQuery must be of type buffer.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//queries/byte/null';
var queryParameters = [];
if (byteQuery !== null && byteQuery !== undefined) {
queryParameters.push('byteQuery=' + encodeURIComponent(msRest.serializeObject(byteQuery)));
}
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
httpRequest.body = null;
// Validate
try {
if (dateQuery && !(dateQuery instanceof Date ||
(typeof dateQuery.valueOf() === 'string' && !isNaN(Date.parse(dateQuery))))) {
throw new Error('dateQuery must be of type date.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//queries/date/null';
var queryParameters = [];
if (dateQuery !== null && dateQuery !== undefined) {
queryParameters.push('dateQuery=' + encodeURIComponent(msRest.serializeObject(dateQuery).replace(/[Tt].*[Zz]/, '')));
}
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if(options) {
for(var headerName in options['customHeaders']) {
var requestUrl = this.client.baseUri +
'//reqopt/optional/string/property';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
// Create HTTP transport objects
var httpRequest = new WebResource();
httpRequest.method = 'POST';
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
// Serialize Request
var requestContent = null;
requestContent = JSON.stringify(msRest.serializeObject(bodyParameter));
httpRequest.body = requestContent;
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ? requestContent.length : Buffer.byteLength(requestContent, 'UTF8');
// Send Request
return client.pipeline(httpRequest, function (err, response, responseBody) {
if (err) {
return callback(err);
}
var statusCode = response.statusCode;
if (statusCode !== 200) {
var error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = httpRequest;
error.response = response;
if (responseBody === '') responseBody = null;
var parsedErrorResponse;
try {