程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> html5-SuperAgent如何用get 方法傳值

html5-SuperAgent如何用get 方法傳值

編輯:編程綜合問答
SuperAgent如何用get 方法傳值

我使用

 request=require('superagent');
 csrftoken=$('meta[name=csrf-token]').attr('content');
 request.get('/auth/~me',headers={'X-CSRFToken': csrftoken, 'content-type': 'application/json', 'Current-User': 'cde5d6s46e465dsa4'}) .end((function(_this){
            return function(err,res) {
                if(res.ok) {
                    console.log(res);
                    switch (res.body.code) {
                        case 0:
                                                ......
                                        }
                                }
                        }
            )(this));


在獲取的收獲是python

current_user = request.headers.get('Current-User')
if current_user == 'cde5d6s46e465dsa4' and request.method == 'GET':
....

獲取後輸出的current_user為null method為GET,請問各位老師是request.get裡面哪裡設置錯了嗎?該如何修改才能用GET方法讓後台獲取到cde5d6s46e465dsa4,謝謝。

最佳回答:


同行參考https://cnodejs.org/topic/5378720ed6e2d16149fa16bd

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved