国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

node.js - 如何獲取post請求返回response的值?

瀏覽:167日期:2024-07-16 08:33:20

問題描述

node.js - 如何獲取post請求返回response的值?

getUser: function (sessionId) {fetch(’/account_auth_admin_new_test/personal-api.accessLogin’, { method: ’POST’, headers: {’Content-Type’: ’application/json’ }, body: JSON.stringify({sessionId: sessionId,enterpriseCode: 'SUNEEE',clientIp: '127.0.0.1',encryptCode:'1234567899876543',appCode: 'XIANGPU' })}).then(function(res){ console.log(res.json())}).then(function(err){ console.log(’錯誤’,err)}) }

fetch模塊:https://github.com/github/fetch

問題解答

回答1:

getUser: function (sessionId) { fetch(’/account_auth_admin_new_test/personal-api.accessLogin’, {method: ’POST’,headers: { ’Content-Type’: ’application/json’},body: JSON.stringify({ sessionId: sessionId, enterpriseCode: 'SUNEEE', clientIp: '127.0.0.1', encryptCode:'1234567899876543', appCode: 'XIANGPU'}) }).then(function(res){return res.json() }).then(function(json) {console.log(’parsed json’, json) }).catch(function(ex) {console.log(’parsing failed’, ex) }).then(function(err){console.log(’錯誤’,err) })}

相關文章:
主站蜘蛛池模板: 勃利县| 高密市| 松潘县| 孝义市| 绥棱县| 东方市| 北海市| 华池县| 新沂市| 南澳县| 武定县| 金昌市| 桃园县| 黑龙江省| 巴林左旗| 高阳县| 锦屏县| 阜新市| 高密市| 双桥区| 宁城县| 枞阳县| 广汉市| 当阳市| 阿拉善左旗| 工布江达县| 河北省| 柞水县| 蒲江县| 得荣县| 同仁县| 渝中区| 兴宁市| 民县| 绥棱县| 河间市| 安仁县| 老河口市| 永吉县| 麻城市| 双柏县|