You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
524 B
28 lines
524 B
/**!
|
|
* default-user-agent - index.js
|
|
*
|
|
* Copyright(c) fengmk2 and other contributors.
|
|
* MIT Licensed
|
|
*
|
|
* Authors:
|
|
* fengmk2 <fengmk2@gmail.com> (http://fengmk2.com)
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
/**
|
|
* Module dependencies.
|
|
*/
|
|
|
|
var osName = require('os-name');
|
|
|
|
var USER_AGENT = 'Node.js/' + process.version.slice(1)
|
|
+ ' (' + osName() + '; ' + process.arch + ')';
|
|
|
|
module.exports = function ua(name, version) {
|
|
if (arguments.length !== 2) {
|
|
return USER_AGENT;
|
|
}
|
|
return name + '/' + version + ' ' + USER_AGENT;
|
|
};
|