Skip to content

v0.7.0

Compare
Choose a tag to compare
@Guest0x0 Guest0x0 released this 24 Sep 08:22
· 20 commits to main since this release
  • Replace Bytes with String in various places, all String` are encoded with UTF8:
    • file name in @fs, including parameters to open, remove etc. and result of readdir etc.
    • process name, command line arguments passed to process, and environment variables passed to process in @process
    • network host name in @socket, @tls and @http
    • URL and header key/value in @http
  • large refactor on the API of @http:
    • @http.Client and @http.ServerConnection now implements @io.Writer, and request/response body should be sent using @io.Writer API. See the README of @http for more details and examples. Note that @http.Client and @http.ServerConnection are buffered when writing request/response body, so manual flush call may be necessary
    • HTTP headers are now represented using Map[String, String] instead of Array[Header]. Duplicated headers in incoming request/response will be joined with ,, as specified by the HTTP protocol
    • @http.get, @http.put, @http.Client::get etc. now uses an abstract type &Body instead of Bytes for sending/receiving request/response body. While sending, both Bytes, String and Json implements trait Body, and can be directed passed to @http.put etc., so this is a non-breaking change. On the receiving side, the returned body can be converted to desired format using .binary()/.text()/.json(). String and Json are all considered UTF8-encoded.
    • @http.Client::read_all and @http.ServerConnection::read_all now also return &Body instead of Bytes
    • @http.Reader is made private
  • @async.with_timeout now raises @async.TimeoutError instead of silently return on timeout. In return, @async.with_timeout can now return result of arbitrary type on success
  • remove some previously deprecated API (@http.request, @http.Client::shutdown)