如何在URL中间发送带有参数的JSON请求
我一直在试图创build一个node.js json请求对象。 我需要在URLpath中间传递一个参数。 我给下面,但它不工作..请教你,请帮忙?
var alertModel = { method:'GET', pathparam:{accountNum: '21703774771466'}, path:"/v1/note/sen/${accountNum}/notes", qs:{ category:'NOTES' } }
您正在使用带双引号的模板文字 。 而是使用反引号:
path: `/v1/note/sen/${accountNum}/notes`,
使用反引号:
let accountNum=21703774771466; var alertModel = { method:'GET', path:`/v1/note/sen/${accountNum}/notes`, qs:{ category:'NOTES' } }
使用node.js> = 4.xx