我正在尝试使用http-proxy代理对REST API的调用,但它会不断返回404代码.
这是对我的API的示例调用:http://petrpavlik.apiary-mock.com/notes它返回一些JSON数据.
这就是我的服务器代码:
var httpProxy = require('http-proxy');
var proxy = httpProxy.createServer({
target:'http://petrpavlik.apiary-mock.com'
});
proxy.listen(8005);
proxy.on('error', function (err, req, res) {
res.writeHead(500, {
'Content-Type': 'text/plain'
});
res.end('Something went wrong. And we are reporting a custom error message.');
});
proxy.on('proxyRes', function (res) {
console.log('RAW Response from the target', JSON.stringify(res.headers, true, 2));
});
Run Code Online (Sandbox Code Playgroud)
当我尝试使用我的代理调用相同的请求时,这就是我得到的.
Petrs-MacBook-Air-2:~ petr$ curl -v 127.0.0.1:8005/notes
* About to connect() to 127.0.0.1 port 8005 (#0)
* Trying 127.0.0.1...
* Adding handle: conn: 0x7f977280fe00
* Adding …Run Code Online (Sandbox Code Playgroud) 我有一个UILabel,我想要的是将它的高度平滑地改为0.
CGRect newFrame = self.label1.frame;
newFrame.size.height = 0;
[UIView animateWithDuration:1.0 animations:^{
self.label1.frame = newFrame;
}];
Run Code Online (Sandbox Code Playgroud)
问题是动画干扰了一些奇怪的事情.我想标签正试图调整大小并重新定位它的文本,这就是为什么它不起作用.我尝试过标签上所有可能的属性组合,但没有成功.