Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit 0190532

Browse files
author
Wim Spaargaren
committed
chore: allow the entiry request or response body to be deleted
1 parent 272ab09 commit 0190532

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

proxywasm/hostcall.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ func GetHttpRequestBody(start, maxSize int) ([]byte, error) {
130130

131131
func SetHttpRequestBody(body []byte) error {
132132
if len(body) == 0 {
133-
return types.StatusToError(types.StatusBadArgument)
133+
st := rawhostcall.ProxySetBufferBytes(types.BufferTypeHttpRequestBody, 0, len(body), nil, len(body))
134+
return types.StatusToError(st)
134135
}
135136
bufferData := &body[0]
136137
st := rawhostcall.ProxySetBufferBytes(types.BufferTypeHttpRequestBody, 0, len(body), bufferData, len(body))
@@ -200,7 +201,8 @@ func GetHttpResponseBody(start, maxSize int) ([]byte, error) {
200201

201202
func SetHttpResponseBody(body []byte) error {
202203
if len(body) == 0 {
203-
return types.StatusToError(types.StatusBadArgument)
204+
st := rawhostcall.ProxySetBufferBytes(types.BufferTypeHttpRequestBody, 0, len(body), nil, len(body))
205+
return types.StatusToError(st)
204206
}
205207
bufferData := &body[0]
206208
st := rawhostcall.ProxySetBufferBytes(types.BufferTypeHttpResponseBody, 0, len(body), bufferData, len(body))

0 commit comments

Comments
 (0)