curl 不打印返回值信息
curl 大约 1964 字需求
curl
不打印返回值信息,只打印HTTP
请求头、返回头、连接信息等。
为了排查Chrome
开发者工具network
选项卡中status
显示(failed)
,具体内容是:net::ERR_INCOMPLETE_CHUNKED_ENCODING
。
-o
使用curl
的-o
参数,o
表示output
输出到指定文件。
只需输出到/dev/null
黑洞中即可。
命令
curl -vv -o /dev/null http://localhost:8081/test
输出
curl -vv -o /dev/null http://localhost:8081/test
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 127.0.0.1:8081...
* Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /test HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.88.1
> Accept: */*
>
< HTTP/1.1 200
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: application/json
< Transfer-Encoding: chunked
< Date: Thu, 29 Jun 2023 05:50:29 GMT
<
{ [7862 bytes data]
* transfer closed with outstanding read data remaining
100 12634 0 12634 0 0 341k 0 --:--:-- --:--:-- --:--:-- 397k
* Closing connection 0
curl: (18) transfer closed with outstanding read data remaining
-s
:不显示进度信息
❯ curl -vv -s -o /dev/null http://localhost:8081/test
* Trying 127.0.0.1:8081...
* Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /test HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.88.1
> Accept: */*
>
< HTTP/1.1 200
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: application/json
< Transfer-Encoding: chunked
< Date: Thu, 29 Jun 2023 05:59:30 GMT
<
{ [7862 bytes data]
* transfer closed with outstanding read data remaining
* Closing connection 0
阅读 173 · 发布于 2023-09-01
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
JVM:浅堆、深堆和保留集阅读 975
-
Spring Boot 配置异步任务、定时任务、Tomcat 的线程池参数阅读 951
-
Java 并发编程之 AQS Semaphore 源码解析阅读 1520
-
CSS injected stylesheet 注入样式导致样式异常阅读 661
-
Java SPI 机制阅读 868
-
Elasticsearch 使用 RESTful API 进行通信阅读 1829
-
Linux 升级 OpenSSL 版本阅读 5066
-
PowerShell 快捷键阅读 1885
-
Maven 引用 Spring Boot Snapshot 和 Milestone 仓库阅读 166
-
CSS 网页变灰效果阅读 1961