如何在node.js中获取http响应正文?

时间:2018-11-16 21:28:36

标签: javascript node.js json rest web

我正在开发使用RESTful API进行请求和响应的后端代理服务器。但是,该文档对我来说并不友好,我不知道如何从node.js的“ Request Sample”下面获取数据。如何获取数据?

POST /action_name HTTP/1.1
Accept: application/json, */*
Content-Length: 400
Content-Type: application/json
Host: builder.open.co.kr
Authorization: token TOKEN_STRING


{
    "version": "2.0",
    "action": {
        "actionName": "{{string}}",
        "parameters": {
            KEY: {
                "type": "{{string}}",
                "value": VALUE
            }
        }
    }
    "context": {
        "accessToken": "{{string}}",
        "device": {
            "type": "{{string}}",
            "state": {
                KEY: VALUE
            }
        },
        "supportedInterfaces": {
            "AudioPlayer": {
                "playerActivity": "PLAYING",
                "token": "string value",
                "offsetInMilliseconds": 100000
            }  
        },
        "privatePlay" : { } // reserved
    }
}

谢谢。

0 个答案:

没有答案