mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
remove blob() call from jshttp.ToResponse
This commit is contained in:
parent
94f29ebdf1
commit
bf3ab8ec41
@ -26,12 +26,7 @@ func toResponse(res js.Value, body io.ReadCloser) (*http.Response, error) {
|
|||||||
// ToResponse converts JavaScript sides Response to *http.Response.
|
// ToResponse converts JavaScript sides Response to *http.Response.
|
||||||
// - Response: https://developer.mozilla.org/docs/Web/API/Response
|
// - Response: https://developer.mozilla.org/docs/Web/API/Response
|
||||||
func ToResponse(res js.Value) (*http.Response, error) {
|
func ToResponse(res js.Value) (*http.Response, error) {
|
||||||
promise := res.Call("blob")
|
body := jsutil.ConvertReadableStreamToReadCloser(res.Get("body"))
|
||||||
blob, err := jsutil.AwaitPromise(promise)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
body := jsutil.ConvertReadableStreamToReadCloser(blob.Call("stream"))
|
|
||||||
return toResponse(res, body)
|
return toResponse(res, body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user