为什么我的curl命令响应成功,而wget命令返回405响应?

问题描述 投票:0回答:1

我正在执行如下两个命令:

curl http://somehost:port/endpoin

这返回我成功的回应。

而如果我用 wget 执行相同的命令如下:

wget --spider -S http://somehost:port/endpoint

这给了我一个 405 Method not allowed 错误。

如果我简单地执行 wget

http://somehost:port/endpoint
我可以成功下载文件。

有人可以帮我理解这个问题吗?

docker shell http kubernetes client-server
1个回答
0
投票

当你运行这个命令时

curl http://somehost:port/endpoin

它发送请求

GET
方法。

但另一个使用

HEAD
方法。因此该服务可能只允许
GET
方法并拒绝其他方法。

© www.soinside.com 2019 - 2024. All rights reserved.