Skip to content

Commit 9e7dde5

Browse files
committed
Bump to 0.7.0
1 parent f8a9d23 commit 9e7dde5

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22

33
name = "conduit-router"
4-
version = "0.6.4"
4+
version = "0.7.0"
55
authors = ["[email protected]"]
66
license = "MIT"
77
description = "Router middleware for conduit based on route-recognizer"
88
repository = "https://github.com/conduit-rust/conduit-router"
99

1010
[dependencies]
11-
conduit = "0.6"
11+
conduit = "0.7"
1212
route-recognizer = "0.1.0"
1313
semver = "0.1"

src/lib.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![feature(core, std_misc)]
2-
#![cfg_attr(test, feature(old_io))]
2+
#![cfg_attr(test, feature(io, net))]
33

44
extern crate "route-recognizer" as router;
55
extern crate conduit;
@@ -124,8 +124,8 @@ impl<'a> RequestParams<'a> for &'a (Request + 'a) {
124124
mod tests {
125125
extern crate semver;
126126
use std::collections::HashMap;
127-
use std::old_io::{MemReader, IoError};
128-
use std::old_io::net::ip::IpAddr;
127+
use std::io;
128+
use std::net::IpAddr;
129129

130130
use {RouteBuilder, RequestParams};
131131

@@ -162,7 +162,7 @@ mod tests {
162162
fn remote_ip(&self) -> IpAddr { unimplemented!() }
163163
fn content_length(&self) -> Option<u64> { unimplemented!() }
164164
fn headers<'a>(&'a self) -> &'a Headers { unimplemented!() }
165-
fn body<'a>(&'a mut self) -> &'a mut Reader { unimplemented!() }
165+
fn body<'a>(&'a mut self) -> &'a mut io::Read { unimplemented!() }
166166
fn extensions<'a>(&'a self) -> &'a Extensions {
167167
&self.extensions
168168
}
@@ -178,7 +178,9 @@ mod tests {
178178
let mut res = router.call(&mut req).ok().expect("No response");
179179

180180
assert_eq!(res.status, (200, "OK"));
181-
assert_eq!(res.body.read_to_string().unwrap(), "1, Get".to_string());
181+
let mut s = String::new();
182+
res.body.read_to_string(&mut s).unwrap();
183+
assert_eq!(s, "1, Get".to_string());
182184
}
183185

184186
#[test]
@@ -188,7 +190,9 @@ mod tests {
188190
let mut res = router.call(&mut req).ok().expect("No response");
189191

190192
assert_eq!(res.status, (200, "OK"));
191-
assert_eq!(res.body.read_to_string().unwrap(), "10, Post".to_string());
193+
let mut s = String::new();
194+
res.body.read_to_string(&mut s).unwrap();
195+
assert_eq!(s, "10, Post".to_string());
192196
}
193197

194198
#[test]
@@ -205,16 +209,15 @@ mod tests {
205209
router
206210
}
207211

208-
fn test_handler(req: &mut conduit::Request)
209-
-> Result<conduit::Response, IoError> {
212+
fn test_handler(req: &mut conduit::Request) -> io::Result<conduit::Response> {
210213
let mut res = vec!();
211214
res.push(req.params()["id"].clone());
212215
res.push(format!("{:?}", req.method()));
213216

214217
Ok(conduit::Response {
215218
status: (200, "OK"),
216219
headers: HashMap::new(),
217-
body: Box::new(MemReader::new(res.connect(", ").into_bytes()))
220+
body: Box::new(io::Cursor::new(res.connect(", ").into_bytes()))
218221
})
219222
}
220223
}

0 commit comments

Comments
 (0)