Move the functionality of sending content response into WebSocketTransport so that user's closure is simpler.
diff --git a/js/ContentObject.js b/js/ContentObject.js
index 9567e44..8450a00 100644
--- a/js/ContentObject.js
+++ b/js/ContentObject.js
@@ -6,7 +6,7 @@
var ContentObject = function ContentObject(_name,_signedInfo,_content,_signature){
- if (typeof _name === 'string'){
+ if (typeof _name == 'string') {
this.name = new Name(_name);
}
else{
@@ -14,7 +14,13 @@
this.name = _name;
}
this.signedInfo = _signedInfo;
- this.content=_content;
+
+ if (typeof _content == 'string') {
+ this.content = DataUtils.toNumbersFromString(_content);
+ } else {
+ this.content = _content;
+ }
+
this.signature = _signature;
@@ -270,6 +276,9 @@
this.locator =_locator;//KeyLocator
this.freshnessSeconds =_freshnessSeconds; // Integer
this.finalBlockID=_finalBlockID; //byte array
+
+ // SWT: merge setFields() method into constructor
+ this.setFields();
};