在Pharo中发出HTTP请求并获取响应头

dav*_*ave 6 smalltalk http squeak pharo

如何发出HTTP请求并同时获取响应内容和响应头?

mar*_*neg 7

或者使用新的Zinc框架,例如:

| response content headers |

response := ZnClient new 
    url: 'http://stackoverflow.com';
    get;
    response.

content := response contents.
headers := response headers.
Run Code Online (Sandbox Code Playgroud)


Luk*_*gli 3

WebClient最简单的方法可能是从http://www.squeaksource.com/WebClient加载。