extern crate serde;
extern crate serde_json;

use hyper::Client;
use hyper::client::{Body, Response};
use hyper::header::Headers;
use hyper::status::StatusCode;
use jira_request::*;
use std::io::Read;

pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<Vec<T>, String> {
    let client = Client::new();
    let url = format!("{}{}", &request.base_url(), &request.path());

    let mut res: Response = client.request(request.method(), &url)
        .headers(request.headers().unwrap_or(Headers::new()))
        .body(&request.body().unwrap_or("".to_string()))
        .send()
        .map_err(|e| e.to_string())?;

    let mut body = String::new();
    res.read_to_string(&mut body).map_err(|e| e.to_string())?;
    match res.status {
        StatusCode::Ok => serde_json::from_str::<Vec<T>>(&body).map_err(|e| e.to_string()),
        _ => Err(body)
    }
}
extern crate serde;
extern crate serde_json;

use hyper::Client;
use hyper::client::{Body, Response};
use hyper::header::Headers;
use hyper::status::StatusCode;
use jira_request::*;
use std::io::Read;

pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<T, String> {
    let client = Client::new();
    let url = format!("{}{}", &request.base_url(), &request.path());

    let mut res: Response = client.request(request.method(), &url)
        .headers(request.headers().unwrap_or(Headers::new()))
        .body(&request.body().unwrap_or("".to_string()))
        .send()
        .map_err(|e| e.to_string())?;

    let mut body = String::new();
    res.read_to_string(&mut body).map_err(|e| e.to_string())?;
    match res.status {
        StatusCode::Ok => serde_json::from_str::<T>(&body).map_err(|e| e.to_string()),
        _ => Err(body)
    }
}
--- 
+++ 
@@ -8,7 +8,7 @@
 use jira_request::*;
 use std::io::Read;
 
-pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<T, String> {
+pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<Vec<T>, String> {
     let client = Client::new();
     let url = format!("{}{}", &request.base_url(), &request.path());
 
@@ -21,7 +21,7 @@
     let mut body = String::new();
     res.read_to_string(&mut body).map_err(|e| e.to_string())?;
     match res.status {
-        StatusCode::Ok => serde_json::from_str::<T>(&body).map_err(|e| e.to_string()),
+        StatusCode::Ok => serde_json::from_str::<Vec<T>>(&body).map_err(|e| e.to_string()),
         _ => Err(body)
     }
 }
:art: Change to return the array of struct

