下面是wget的命令和响应,它第一次不使用提供的用户名和密码得到401,后来它使用auth得到200。
这对 curl 很有效,但同样的事情也会通过 Postman 发生,这是什么现象以及为什么会发生?
$> wget 'http://userName:password@host:port/v1/api'
--2018-08-31 16:06:01-- http://userName:password@host:port
Connecting to host:port... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Basic realm="myApp", API-Key realm="myApp"
Reusing existing connection to host:port.
HTTP request sent, awaiting response... 200 OK
Length: 146 [application/json]
Saving to: 'api'
api 100%[==================================================================================================================>] 146 --.-KB/s in 0s
2018-08-31 16:06:01 (9.28 MB/s) - 'api' saved [146/146]
Run Code Online (Sandbox Code Playgroud)