[#3058] soft-deprecated 'data' prop in favour of 'body' to allow raw strings

This commit is contained in:
Gani Georgiev
2023-08-03 12:31:50 +03:00
parent b3f09ff045
commit b1093baef7
5 changed files with 2665 additions and 2646 deletions
+3 -4
View File
@@ -921,8 +921,6 @@ func TestHttpClientBindsSend(t *testing.T) {
bodyRaw, _ := io.ReadAll(req.Body)
defer req.Body.Close()
body := map[string]any{}
json.Unmarshal(bodyRaw, &body)
// normalize headers
headers := make(map[string]string, len(req.Header))
@@ -935,7 +933,7 @@ func TestHttpClientBindsSend(t *testing.T) {
info := map[string]any{
"method": req.Method,
"headers": headers,
"body": body,
"body": string(bodyRaw),
}
infoRaw, _ := json.Marshal(info)
@@ -992,8 +990,8 @@ func TestHttpClientBindsSend(t *testing.T) {
const test1 = $http.send({
method: "post",
url: testUrl,
data: {"data": "example"},
headers: {"header1": "123", "header2": "456"},
body: '789',
})
// with custom content-type header
@@ -1012,6 +1010,7 @@ func TestHttpClientBindsSend(t *testing.T) {
"json.headers.header1": "123",
"json.headers.header2": "456",
"json.headers.content_type": "application/json", // default
"json.body": "789",
}],
[test2, {
"statusCode": "200",