有两件事混淆了这里发生的事情:
POSTMAN 跟踪 GET 请求的重定向,但不提供有关请求历史记录的信息(例如,如果我说 GET URL1 并被重定向到 GET URL2,它只会告诉我我原来的 GET URL1,即使它提供了 GET URL2 的结果)
文档中的 cURL 示例包含一个 -L 标志,它告诉 cURL 遵循重定向。cURL 不以提供明确要求之外的任何信息而闻名,这是另一种情况。
如果您想查看实际发生的情况,可以通过添加 'v 标志将 cURL 置于详细模式并查看发生的所有情况,例如:
curl -v -L https://api.box.com/2.0/files/FILE_ID/content -H "Authorization: Bearer TOKEN"
* About to connect() to api.box.com port 443 (#0)
* Trying 74.112.184.225...
* connected
* Connected to api.box.com (74.112.184.225) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
* subject: serialNumber=ts5jamwzcjWP0oTyh2m74yh0zsB2zyOR; C=US; ST=California; L=Palo Alto; O=Box.net, Inc.; CN=*.box.com
* start date: 2011-09-27 22:07:27 GMT
* expire date: 2013-09-29 11:02:11 GMT
* subjectAltName: api.box.com matched
* issuer: C=US; O=GeoTrust, Inc.; CN=GeoTrust SSL CA
* SSL certificate verify ok.
> GET /2.0/files/5620199214/content HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: api.box.com
> Accept: */*
> Authorization: Bearer TOKEN
>
< HTTP/1.1 302 Found
< Server: nginx
< Date: Sun, 17 Mar 2013 20:48:40 GMT
< Content-Type: text/html; charset=utf-8
< Connection: keep-alive
< Cache-control: no-cache, no-store
< Location: https://www.boxcloud.com/bc/1/b4c1b5e872bf843d3ded7bcae5f4f175/2Of-pgQHiFlfW6KldVyHAxtUIEW0l7HoOpi14-VGcxcSnn2CtobCO1UjJZLI58w_oCTNcPMKbUR_gn-ncDkAbw,,/f9a04d69f716d92ceebd848bb9ccded8/
< Content-Length: 0
<
* Connection #0 to host api.box.com left intact
* Issue another request to this URL: 'https://www.boxcloud.com/bc/1/b4c1b5e872bf843d3ded7bcae5f4f175/2Of-pgQHiFlfW6KldVyHAxtUIEW0l7HoOpi14-VGcxcSnn2CtobCO1UjJZLI58w_oCTNcPMKbUR_gn-ncDkAbw,,/f9a04d69f716d92ceebd848bb9ccded8/'
* About to connect() to www.boxcloud.com port 443 (#1)
* Trying 74.112.184.74...
* connected
* Connected to www.boxcloud.com (74.112.184.74) port 443 (#1)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
* subject: serialNumber=o2MxwjKDoF9mEZ3YNhBMR/WISRBUXT6b; C=US; ST=California; L=Palo Alto; O=Box, Inc.; CN=*.boxcloud.com
* start date: 2012-02-27 00:10:39 GMT
* expire date: 2014-03-01 01:48:45 GMT
* subjectAltName: www.boxcloud.com matched
* issuer: C=US; O=GeoTrust, Inc.; CN=GeoTrust SSL CA
* SSL certificate verify ok.
> GET /bc/1/b4c1b5e872bf843d3ded7bcae5f4f175/2Of-pgQHiFlfW6KldVyHAxtUIEW0l7HoOpi14-VGcxcSnn2CtobCO1UjJZLI58w_oCTNcPMKbUR_gn-ncDkAbw,,/f9a04d69f716d92ceebd848bb9ccded8/ HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: www.boxcloud.com
> Accept: */*
> Authorization: Bearer TOKEN
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Sun, 17 Mar 2013 20:48:41 GMT
< Content-Type: image/png
< Content-Length: 15039
< Connection: keep-alive
< Cache-control: private
< Accept-Ranges: bytes
< Content-Disposition: attachment;filename="Screenshot_1_14_13_5_33_PM.png";filename*=UTF-8''Screenshot_1_14_13_5_33_PM.png
< X-Content-Type-Options: nosniff
< Accept-Ranges: bytes
<
?PNG
…