2015-11-12 29 views
0

我執行我的流星應用休息服務器,我需要從該請求獲得一個參數...讀緩衝區六角流星服務器

問題是參數自帶的格式如下:

data <Buffer 74 65 78 74 3d 77 6f 72 64 73> 

當我打電話

curl -v 'http://localhost:3000/pagseguroNotifications' -d "text=words" 

緩衝器是實際參數,但在hexadcimal ...

我會如何將它轉換爲流星中的簡單字符串?

我的代碼如下:

HTTP.methods({ 
    '/pagseguroNotifications': function(data) { 
    this.setContentType("application/x-www-form-urlencoded"); 
    this.setStatusCode(200); 

    console.log("data: ", data); 
    } 
}); 

回答

0

緩衝區有toString()方法。無參數調用時,它將整個緩衝區轉換爲utf8字符串。