mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2025-03-10 17:29:10 +00:00
♻️
This commit is contained in:
parent
04f6573b78
commit
896b5a3cee
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
// Request builds and returns the equivalent http.Request
|
||||
func Request(r js.Value) (*http.Request, error) {
|
||||
func Request(r js.Value) *http.Request {
|
||||
jsBody := js.Global().Get("Uint8Array").New(Promise{r.Call("arrayBuffer")}.Await())
|
||||
body := make([]byte, jsBody.Get("length").Int())
|
||||
js.CopyBytesToGo(body, jsBody)
|
||||
@ -29,5 +29,5 @@ func Request(r js.Value) (*http.Request, error) {
|
||||
req.Header.Set(v.Index(0).String(), v.Index(1).String())
|
||||
}
|
||||
|
||||
return req, nil
|
||||
return req
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user