Outdated res.send() syntax in lib/response.js documentation example

オープン 初心者向け
#7,588 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #7598 @VaibhavBajpaij による — マージされずにクローズ

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
95/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
express, javascript, node.js

調査の方向性

lib/response.js の367行目付近にある res.sendFile() のドキュメントコメントを読みます。非推奨の res.send(status, body) の例を、issue に示されているサポート対象の Express 5 構文に置き換えます。その例で res.status(403).send(...) が使われていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

docs
Description

In lib/response.js, the documentation comment for res.sendFile() still uses the following example on line 367:

res.send(403, 'Sorry! you can\'t see that.');

This uses the old res.send(status, body) syntax, which was deprecated in Express 4.7.0 and removed in Express 5 according to the documentations.
The official Express 5 API documentation already uses the updated syntax, but the example in lib/response.js hasn't been updated.

References:

  1. Source code: https://github.com/expressjs/express/blob/master/lib/response.js#L367
  2. Express 4 API documentation: https://expressjs.com/en/4x/api/response/
  3. Express 5 release announcement: https://expressjs.com/en/blog/2024-10-15-v5-release/
  4. Express 5 API documentation: https://expressjs.com/en/5x/api/response/
Expectations

Update the example in lib/response.js to use the supported Express 5 syntax:

res.status(403).send('Sorry! you can\'t see that.');

This would make the example consistent with the official Express 5 API documentation.
I'm happy to submit a pull request to update this example if you'd like.

主要言語
JavaScript
スター
69.7k
フォーク
25.6k
平均マージ
2日 9時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

expressjs/express のほかの issue

expressjs/express の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。