[英]How to make HTTP client requests with Deno
I'm playing around with Deno but I can't find the standard HTTP client.我正在玩 Deno,但找不到标准的 HTTP 客户端。
I also googled "deno http client" which gives me https://deno.land/x/std/http/client/ , but the link is broken.我还用谷歌搜索了“deno http 客户端”,它给了我https://deno.land/x/std/http/client/ ,但链接已损坏。 Something was indexed by Google and later removed from the repo.
一些东西被谷歌索引,后来从回购中删除。
404 - Not Found
This file or directory could not be found.
I found 3rd party libraries soxa and deno-http but I am looking for something standard.我找到了 3rd 方库soxa和deno-http但我正在寻找标准的东西。
Is there a standard HTTP client for Deno that I am missing?我缺少 Deno 的标准 HTTP 客户端吗?
deno
implements a variety of Web APIs . deno
实现了多种Web API 。 To make an HTTP request in deno
you use fetch
.要在
deno
中发出 HTTP 请求,您可以使用fetch
。
const res = await fetch('https://jsonplaceholder.typicode.com/todos/1');
const data = await res.json();
Web APIs are exposed to the global scope the same way they're in the browser. Web API 暴露给全局 scope 就像它们在浏览器中一样。
deno
aims to be browser compatible whenever it's possible. deno
旨在尽可能与浏览器兼容。
You'll also be able to use:您还可以使用:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.