1. Home
  2. Docs
  3. Manual
  4. Playbook
  5. Command list
  6. HttpCommand component

HttpCommand component

Based on the simple encapsulation of the XML HttpRequest component that comes with QML, the specific source code is:
https://github.com/aoyiduo/woterm/blob/main/private/playbooks/test/http.js
Its reference example:
https://github.com/aoyiduo/woterm/blob/main/private/playbooks/test/TestHttpCommand.qml

The core code is as follows:

import "http.js" as Http


asyncGenerator(function *(){
    yield Http.get(url.text).then(function(obj){
         Playbook.log("success to get------------")
         Playbook.log(obj.headers)
         Playbook.log("\r\n\r\n"+obj.body)
    ).catch(function(err){
         Playbook.log("failed to get content.", err.status, err.statusText)
    })
})()