久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

node.js - 如何獲取post請(qǐng)求返回response的值?

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

問題描述

node.js - 如何獲取post請(qǐng)求返回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(’錯(cuò)誤’,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(’錯(cuò)誤’,err) })}

相關(guān)文章:
主站蜘蛛池模板: 页游| 承德县| 太仆寺旗| 宁安市| 白玉县| 新龙县| 西吉县| 定西市| 广宗县| 米脂县| 日土县| 兴安县| 永泰县| 武强县| 吉首市| 泉州市| 美姑县| 大连市| 噶尔县| 鄯善县| 昌图县| 敦化市| 新田县| 青海省| 孙吴县| 香河县| 虹口区| 鄂托克前旗| 巧家县| 云龙县| 疏附县| 邯郸市| 闻喜县| 天气| 定襄县| 西昌市| 宁化县| 黔西| 永昌县| 石门县| 淄博市|