mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
update tests
This commit is contained in:
parent
c2d8abcee7
commit
791a980e2d
@ -81,7 +81,7 @@ openssl = { version="0.10", optional = true }
|
|||||||
tokio-openssl = { version="0.2", optional = true }
|
tokio-openssl = { version="0.2", optional = true }
|
||||||
|
|
||||||
[dependencies.actix]
|
[dependencies.actix]
|
||||||
version = "0.5"
|
version = "^0.5.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
|
@ -139,7 +139,7 @@ fn main() {
|
|||||||
// default
|
// default
|
||||||
.default_resource(|r| {
|
.default_resource(|r| {
|
||||||
r.method(Method::GET).f(p404);
|
r.method(Method::GET).f(p404);
|
||||||
r.route().p(pred::Not(pred::Get())).f(|req| httpcodes::HTTPMethodNotAllowed);
|
r.route().filter(pred::Not(pred::Get())).f(|req| httpcodes::HTTPMethodNotAllowed);
|
||||||
}))
|
}))
|
||||||
|
|
||||||
.bind("127.0.0.1:8080").expect("Can not bind to 127.0.0.1:8080")
|
.bind("127.0.0.1:8080").expect("Can not bind to 127.0.0.1:8080")
|
||||||
|
@ -173,7 +173,8 @@ impl<S: 'static, H: PipelineHandler<S>> HttpHandlerTask for Pipeline<S, H> {
|
|||||||
PipelineState::None =>
|
PipelineState::None =>
|
||||||
return Ok(Async::Ready(true)),
|
return Ok(Async::Ready(true)),
|
||||||
PipelineState::Error =>
|
PipelineState::Error =>
|
||||||
return Err(io::Error::new(io::ErrorKind::Other, "Internal error").into()),
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::Other, "Internal error").into()),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,8 +125,8 @@ impl<T, H> Http1<T, H>
|
|||||||
// TODO: refactor
|
// TODO: refactor
|
||||||
pub fn poll_io(&mut self) -> Poll<bool, ()> {
|
pub fn poll_io(&mut self) -> Poll<bool, ()> {
|
||||||
// read incoming data
|
// read incoming data
|
||||||
let need_read =
|
let need_read = if !self.flags.intersects(Flags::ERROR) &&
|
||||||
if !self.flags.contains(Flags::ERROR) && self.tasks.len() < MAX_PIPELINED_MESSAGES
|
self.tasks.len() < MAX_PIPELINED_MESSAGES
|
||||||
{
|
{
|
||||||
'outer: loop {
|
'outer: loop {
|
||||||
match self.reader.parse(self.stream.get_mut(),
|
match self.reader.parse(self.stream.get_mut(),
|
||||||
@ -1413,6 +1413,10 @@ mod tests {
|
|||||||
assert!(req.chunked().unwrap());
|
assert!(req.chunked().unwrap());
|
||||||
assert!(!req.payload().eof());
|
assert!(!req.payload().eof());
|
||||||
|
|
||||||
|
buf.feed_data("4\r\n1111\r\n");
|
||||||
|
not_ready!(reader.parse(&mut buf, &mut readbuf, &settings));
|
||||||
|
assert_eq!(req.payload_mut().readall().unwrap().as_ref(), b"1111");
|
||||||
|
|
||||||
buf.feed_data("4\r\ndata\r");
|
buf.feed_data("4\r\ndata\r");
|
||||||
not_ready!(reader.parse(&mut buf, &mut readbuf, &settings));
|
not_ready!(reader.parse(&mut buf, &mut readbuf, &settings));
|
||||||
|
|
||||||
@ -1430,6 +1434,7 @@ mod tests {
|
|||||||
buf.feed_data("ne\r\n0\r\n");
|
buf.feed_data("ne\r\n0\r\n");
|
||||||
not_ready!(reader.parse(&mut buf, &mut readbuf, &settings));
|
not_ready!(reader.parse(&mut buf, &mut readbuf, &settings));
|
||||||
|
|
||||||
|
//trailers
|
||||||
//buf.feed_data("test: test\r\n");
|
//buf.feed_data("test: test\r\n");
|
||||||
//not_ready!(reader.parse(&mut buf, &mut readbuf));
|
//not_ready!(reader.parse(&mut buf, &mut readbuf));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user