我正在执行如下两个命令:
curl http://somehost:port/endpoin
这返回我成功的回应。
而如果我用 wget 执行相同的命令如下:
wget --spider -S http://somehost:port/endpoint
这给了我一个 405 Method not allowed 错误。
如果我简单地执行 wget
http://somehost:port/endpoint
我可以成功下载文件。
有人可以帮我理解这个问题吗?
当你运行这个命令时
curl http://somehost:port/endpoin
它发送请求
GET
方法。
但另一个使用
HEAD
方法。因此该服务可能只允许 GET
方法并拒绝其他方法。