- Added `ServerRequest.finalize()`: consuming all unread body stream and trailers.
- This is cleanup method for reading next request from same keep-alive connection.
- Needed when handler didn't consume all body and trailers even after responding.
- refactor: `ServerRequest._bodyStream()`, `ServerRequestBody` are removed.
- Now using `bodyReader()` and `chunkedBodyReader()` instead.
- fix: Trailers should only be read `transfer-encoding` is `chunked` and `trailer` header is set and its value is valid.
- fix: use `Headers.append()` on reading trailers.
- fix: delete `trailer` field from headers after reading trailers.
- reorg: Several functions related to IO are moved into `http/io.ts`
This PR introduces the mutex guard for the test cases which depends on the
permission prompt mocking utility. permission_request test cases depend on
the mocked (dummy) value of the permission_prompt result. The value is stored
at static STUB_PROMPT_VALUE: AtomicBool and these test cases share this
value. So we should lock at the start of these test cases.
Before this change cargo test permission failed 6 times out of 20. After this
change, 0 times out of 20 (on my mac).
To better reflect changes in error types in JS from #3662 this PR changes
default error type used in ops from "ErrBox" to "OpError".
"OpError" is a type that can be sent over to JSON; it has all
information needed to construct error in JavaScript. That
made "GetErrorKind" trait useless and so it was removed altogether.
To provide compatibility with previous use of "ErrBox" an implementation of
"From<ErrBox> for OpError" was added, however, it is an escape hatch and
ops implementors should strive to use "OpError" directly.
Node's os module exports a number of methods that evaluate to themselves
when coerced to a primitive.
I.e., `"" + os.arch` and `os.arch()` evaluate to the same string, and
now Deno's shims do too.
This PR fixes an issue where we recursively analysed imports on plain JS files
in the compiler irrespective of "checkJs" being true. This caused problems
where when analysing the imports of those files, we would mistake some
import like structures (AMD/CommonJS) as dependencies and try to resolve
the "modules" even though the compiler would not actually look at those files.
Fixes #4031
When a bundle contains a single module, we were incorrectly determining
the module name, resulting in a non-functional bundle. This PR corrects
that determination.