向stderr报告HTTP响应标头? [英] Report HTTP Response Headers to stderr?

查看:61
本文介绍了向stderr报告HTTP响应标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 curl -i http://website.com 很久了.很棒,它报告了响应头和信息.

I have been using curl -i http://website.com for a long time. It's great, it reports the response headers and information.

我还使用了 jq 工具,该工具可以解析并漂亮地打印JSON.我想执行以下操作:

I also use a tool jq which parses and pretty prints JSON. I'd like to do the following:

curl -i http://website.com | jq -r .

此问题是HTTP标头转发到 jq .

The problem with this is that the HTTP headers are forwarded to jq.

是否可以将 -i 重定向到标准错误?

Is there a way to redirect -i to standard error?

推荐答案

尝试以下命令:

curl -s -D/dev/stderr http://www.website.com/... | |jq

这篇关于向stderr报告HTTP响应标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆