This repository was archived by the owner on Nov 9, 2017. It is now read-only.
File tree 3 files changed +3
-3
lines changed 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -55,5 +55,5 @@ fn make_and_print_request(url: ~str) {
55
55
Ok ( body) => body,
56
56
Err ( err) => fail ! ( "Reading response failed: {}" , err) ,
57
57
} ;
58
- println ( str:: from_utf8 ( body) . expect ( "Uh oh, response wasn't UTF-8" ) ) ;
58
+ println ( str:: from_utf8 ( body. as_slice ( ) ) . expect ( "Uh oh, response wasn't UTF-8" ) ) ;
59
59
}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use std::fmt;
4
4
use headers:: { HeaderConvertible , HeaderValueByteIterator } ;
5
5
6
6
pub fn from_stream_with_str < T : HeaderConvertible > ( s : & str ) -> Option < T > {
7
- let mut bytes = s. as_bytes ( ) . into_owned ( ) ;
7
+ let mut bytes = s. bytes ( ) . collect :: < Vec < _ > > ( ) ;
8
8
bytes. push_all ( bytes ! ( "\r \n /" ) ) ;
9
9
let mut reader = MemReader :: new ( bytes) ;
10
10
let mut iter = HeaderValueByteIterator :: new ( & mut reader) ;
Original file line number Diff line number Diff line change @@ -373,7 +373,7 @@ impl Request {
373
373
match request. headers. content_length {
374
374
Some ( length) => {
375
375
match buffer. read_exact( length) {
376
- Ok ( body) => match str :: from_utf8( body) {
376
+ Ok ( body) => match str :: from_utf8( body. as_slice ( ) ) {
377
377
Some ( body_str) => request. body = body_str. to_owned( ) ,
378
378
None => return ( request, Err ( status:: BadRequest ) )
379
379
} ,
You can’t perform that action at this time.
0 commit comments