POSTing with JSON using npm request

前端 未结 3 1514
生来不讨喜
生来不讨喜 2021-02-20 11:04

How would one do the following with the request npm module?

curl https://todoist.com/oauth/access_token \\
    -d client_id=0123456789abcdef \\
             


        
3条回答
  •  一向
    一向 (楼主)
    2021-02-20 11:29

    var url = 'http://xxxxx'
    request({
      url : url,
      method :"POST",
      headers : {
        "content-type": "application/json",
      },
      body: {
        'id':1,
        'name':'xxxx'
      },
      json: true
    },
    

    it's working

提交回复
热议问题