0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

deno v0.28.1の変更点

Last updated at Posted at 2020-01-04

概要

denoのv0.28.1がリリースされたため、変更点をまとめます。

req.bodyが関数からReaderに変更された(std/http)

req.bodyDeno.readAll等のReaderを受け取る関数の引数として渡すことができるようになりました。

それに伴い、req.bodyStream()メソッドが削除されています。

変更による影響

v0.28.0ではリクエストボディをデコードする際は下記のように処理が行われていましたが、

v0.28.0
import { serve } from "https://deno.land/std@v0.28.0/http/server.ts";
const server = serve({ port: 8000 });
for await (const req of server) {
  const body = await req.body();
  console.info(new TextDecoder("utf-8").decode(body));
  ...
}

v0.28.1では下記のように変更する必要があります。

v0.28.1
import { serve } from "https://deno.land/std@v0.28.1/http/server.ts";
const server = serve({ port: 8000 });
for await (const req of server) {
  const body = await Deno.readAll(req.body);
  console.info(new TextDecoder("utf-8").decode(body));
  ...
}

req.contentLengthが追加された(std/http)

Content-Lengthヘッダの値をnumber型の値として返却します。

import { serve } from "https://deno.land/std@v0.28.1/http/server.ts";

const server = serve({ port: 8000 });
for await (const req of s) {
  console.info(req.contentLength);
  ...
}

OpenSSLへの動的リンクに関する問題の修正

v0.28.0のリリース時に、reqwestというライブラリがv0.10.0にアップグレードされました。

その間にreqwestライブラリにOpenSSLへの依存が追加されました。(Linux環境のみ)

その関係で、一部Linux環境でdenoのビルドに失敗する問題が発生していたため、修正が実施されたようです。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?