5a884ee
Thanks @ardatan! - Ensure ReadableStream is also cancelled after Reader cancelled if Response.body is ReadableStream
- #142
a8071f7
Thanks @ardatan! - Handle Node requests correctly if Response.body is a native ReadableStream
-
#134
ed098ba
Thanks @enisdenjo! - Improved types -
Updated dependencies [
5d151df
]:- @whatwg-node/fetch@0.4.5
a91ef16
Thanks @ardatan! - - Set ServerContext to an empty object by default for .fetch method- Do not call request handler twice which causes an error
disturbed
- Do not call request handler twice which causes an error
48bdf61
Thanks @ardatan! - Set an empty object if there is no server context sent by the environment
-
#121
a67f447
Thanks @ardatan! - Improvements;createServerAdapter
can now accept the request handler itself.
createServerAdapter(req => { return new Response(`I got ${req.url}`); });
Breaking Changes;
baseObject
in the configuration has been removed! Now you can passbaseObject
itself butbaseObject
needs to implement ahandle
method that is exactly same withhandleRequest
.
- const myServerBaseObject = {...} + const myServerBaseObject = { + handle(req) {/*...*/} + } - const adapter = createServerAdapter({ - baseObject: myServerBaseObject, - handleRequest(req) {/*...*/} - }) + const adapter = createServerAdapter(myServerBaseObject)
handleRequest
has been renamed tohandle
which has the same signature.
createServerAdapter({ - handleRequest(request) { + handle(request) { })
Request
in the configuration needs to be passed as a second argument.
createServerAdapter({ - handleRequest(request) { + handle(request) { - Request: MyRequestCtor - }) + }, MyRequestCtor)
- #78
415b0a5
Thanks @ardatan! - Iffetch
is called with multiple arguments likefetch(request, env, ctx)
(for example CF Workers do that), the parameters afterrequest
will be merged and passed as aServerContext
to the providedhandleRequest
function.
- #78
415b0a5
Thanks @ardatan! - Since Node 18 starts returning IPv6 insocket.localAddress
, the generated URL was broken likehttp://0.0.0.1:3000
. Now it generates the URL ofRequest
on Node 18 correctly. First we respecthost
header as recommended in Node.js documentation. - Updated dependencies [
9a8d873
]:- @whatwg-node/fetch@0.2.9
- 310c21a: Use "webworker" reference for "FetchEvent" type
- Updated dependencies [486c35d]
- @whatwg-node/fetch@0.2.0
- Updated dependencies [b83d7f3]
- Updated dependencies [b83d7f3]
- Updated dependencies [b83d7f3]
- Updated dependencies [b83d7f3]
- @whatwg-node/fetch@0.1.0
- 6aaa591: Use '.originalUrl' if possible to get
Request.url
properly because some frameworks like Express are sending/
tourl
- Updated dependencies [3207383]
- @whatwg-node/fetch@0.0.2
- 889eccf: NEW RELEASES
- Updated dependencies [889eccf]
- @whatwg-node/fetch@0.0.1