Skip to content

Commit

Permalink
docs, refactor: update missing ts files.
Browse files Browse the repository at this point in the history
  • Loading branch information
xicilion committed Apr 11, 2023
1 parent 97309cb commit fc54e7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions npm/types/dts/interface/HttpCookie.d.ts
Expand Up @@ -9,19 +9,19 @@
* const http = require('http');
* const server = new http.Server(8080, function(request) {
* const cookies = request.cookies;
* const name = cookies.first('name');
* const name = cookies.get('name');
* request.response.write(`Hello ${name}!`);
* });
* server.start();
* ```
* 这里我们使用 HttpRequest.cookies 属性获取请求中的所有 cookie。然后使用 cookies.first 方法,传入 cookie 的名称,来获取该 cookie 的值。
* 这里我们使用 HttpRequest.cookies 属性获取请求中的所有 cookie。然后使用 cookies.get 方法,传入 cookie 的名称,来获取该 cookie 的值。
*
* 为了向客户端发送一个 cookie,可以通过 HttpCookie 对象来创建一个新的 cookie 并将其添加到 HttpReponse.cookies 集合中。以下是一个示例:
* ```JavaScript
* const http = require('http');
* const server = new http.Server(8080, function(request) {
* const cookies = request.cookies;
* let name = cookies.first('name');
* let name = cookies.get('name');
*
* if (name) {
* request.response.write(`Hello ${name} again!`);
Expand Down
2 changes: 1 addition & 1 deletion npm/types/dts/interface/HttpRequest.d.ts
Expand Up @@ -12,7 +12,7 @@
* const http = require('http');
*
* var svr = new http.Server(8080, (req) => {
* var name = req.query.first('name');
* var name = req.query.get('name');
* var msg = name ? `Hello ${name}!` : 'Hello world!';
*
* req.response.write(msg);
Expand Down

0 comments on commit fc54e7c

Please sign in to comment.