小编Pet*_*lík的帖子

http-proxy一直返回404

我正在尝试使用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)

http-proxy node.js node-http-proxy

4
推荐指数
2
解决办法
2691
查看次数

将UILabel的高度设置为0

我有一个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)

问题是动画干扰了一些奇怪的事情.我想标签正试图调整大小并重新定位它的文本,这就是为什么它不起作用.我尝试过标签上所有可能的属性组合,但没有成功.

size height animation uilabel ios

1
推荐指数
1
解决办法
2086
查看次数

标签 统计

animation ×1

height ×1

http-proxy ×1

ios ×1

node-http-proxy ×1

node.js ×1

size ×1

uilabel ×1