github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/http_request.en.md (about) 1 ### `http_request()` {#fn-http-request} 2 3 Function prototype: `fn http_request(method: str, url: str, headers: map, body: any) map` 4 5 Function description: Send an HTTP request, receive the response, and encapsulate it into a map 6 7 Function parameters: 8 9 - `method`: GET|POST 10 - `url`: Request path 11 - `headers`: Additional header,the type is map[string]string 12 - `body`: Request body 13 14 Return type: map 15 16 key contains status code (status_code) and result body (body) 17 18 - `status_code`: Status code 19 - `body`: Response body 20 21 Example: 22 23 ```python 24 resp = http_request("GET", "http://localhost:8080/testResp") 25 resp_body = load_json(resp["body"]) 26 27 add_key(abc, resp["status_code"]) 28 add_key(abc, resp_body["a"]) 29 ```