mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-27 16:17:34 +00:00
Feat: add http status and code from http cmd run
Signed-off-by: suxiang <704427617@qq.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"crypto/x509"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
@@ -128,9 +129,11 @@ func (c *HTTPCmd) Run(meta *registry.Meta) (res interface{}, err error) {
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
// parse response body and headers
|
||||
return map[string]interface{}{
|
||||
"body": string(b),
|
||||
"header": resp.Header,
|
||||
"trailer": resp.Trailer,
|
||||
"body": string(b),
|
||||
"header": resp.Header,
|
||||
"trailer": resp.Trailer,
|
||||
"status": resp.Status,
|
||||
"status_code": strconv.Itoa(resp.StatusCode),
|
||||
}, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user