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

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

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

瀏覽:158日期: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) })}

相關文章:
主站蜘蛛池模板: 莱州市| 奉新县| 宜昌市| 海口市| 嫩江县| 洪泽县| 东乌珠穆沁旗| 萍乡市| 三门峡市| 登封市| 乌拉特前旗| 丹寨县| 开化县| 岳阳市| 那坡县| 阿拉尔市| 东丰县| 五河县| 汶川县| 平塘县| 汝阳县| 棋牌| 南宁市| 于都县| 巴马| 黄大仙区| 南岸区| 通化市| 即墨市| 台山市| 山阳县| 化隆| 云南省| 板桥市| 桂东县| 南通市| 伊金霍洛旗| 林甸县| 靖安县| 鹿邑县| 阳高县|