diff --git a/docs/hello-state/api.wasm b/docs/hello-state/api.wasm index 4c976cd..13cb3da 100755 Binary files a/docs/hello-state/api.wasm and b/docs/hello-state/api.wasm differ diff --git a/docs/hello/api.wasm b/docs/hello/api.wasm index 12f64a5..252bfbe 100755 Binary files a/docs/hello/api.wasm and b/docs/hello/api.wasm differ diff --git a/response_recorder.go b/response_recorder.go index 855fde2..2ae000f 100644 --- a/response_recorder.go +++ b/response_recorder.go @@ -37,11 +37,11 @@ func (rr ResponseRecorder) JSValue() js.Value { var body js.Value = js.Undefined() if res.ContentLength != 0 { - body = js.Global().Get("Uint8Array").New(res.ContentLength) var b, err = ioutil.ReadAll(res.Body) if err != nil { panic(err) } + body = js.Global().Get("Uint8Array").New(len(b)) js.CopyBytesToJS(body, b) }