I would like to make a HEAD
HTTP request to get filesize of the requested url, we can make HTTP GET
requests using the below example code from Crossride Docs, my question is how to make a pure HEAD
(with no data downloaded) request in croorider:
appAPI.ready(function($) {
appAPI.request.get({
url: 'http://example.com/api/get_something.json',
onSuccess: function(response, additionalInfo) {
// Display the response
if (appAPI.utils.isObject(response)) {
console.log('Response properties:');
for (p in response) {
console.log(response[p] + ': ' + p);
}
} else
console.log('Response: ' + response);
// Stringify and display the response headers
var headersAsString = '';
for (var x in additionalInfo.headers) {
headersAsString += '\n' + x + ': ' + additionalInfo.headers[x];
}
console.log('Response Headers:' + headersAsString);
},
onFailure: function(httpCode) {
console.log('Failed to retrieve content. (HTTP Code:' + httpCode + ')');
},
additionalRequestHeaders: {
myHeader: 'value'
},
responseDataType: 'application/json'
});
});