Fix UserAgent.encode
This commit is contained in:
parent
001f5b16df
commit
e40a40abd0
|
@ -56,8 +56,8 @@ var encode = exports.encode = function(software) {
|
|||
var ua = software.map(function(soft) {
|
||||
var version = soft.version || "0.0.0";
|
||||
var str = soft.name + ":" + version;
|
||||
if (str.comments) {
|
||||
str += "(" + comments + ")";
|
||||
if (soft.comments) {
|
||||
str += "(" + soft.comments + ")";
|
||||
}
|
||||
return str;
|
||||
}).join("/");
|
||||
|
|
3
test.js
3
test.js
|
@ -402,6 +402,9 @@ describe("High-level classes", function() {
|
|||
expect(res.software).to.deep.equal([pybm]);
|
||||
expect(res.length).to.equal(21);
|
||||
expect(res.rest.toString("hex")).to.equal("");
|
||||
|
||||
ua = UserAgent.encode([{name: "test", "comments": "linux"}]);
|
||||
expect(var_str.decode(ua).str).to.equal("/test:0.0.0(linux)/");
|
||||
});
|
||||
|
||||
it("should encode bitmessage's user agent", function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user