Obama
This commit is contained in:
@@ -65,7 +65,15 @@ async fn api_json_driver(id: web::Path<i32>) -> Json<CommonDriver> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[get("api/json/tickets/{driver}")]
|
#[get("api/json/tickets/{driver}")]
|
||||||
async fn api_json_driver_tickets(id: web::Path<i32>) -> Json<Vec<CommonTicket>> {
|
async fn api_json_driver_tickets(id: web::Path<i32>) -> impl Responder {
|
||||||
let fetched_tickets = get_tickets(&mut establish_connection(), *id);
|
let fetched_tickets = get_tickets(&mut establish_connection(), *id);
|
||||||
Json(fetched_tickets)
|
HttpResponse::Ok()
|
||||||
|
.content_type(ContentType::json())
|
||||||
|
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||||
|
.insert_header(("content-encoded", "gzip"))
|
||||||
|
.insert_header((
|
||||||
|
"Access-Control-Allow-Headers",
|
||||||
|
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||||
|
))
|
||||||
|
.json(fetched_tickets)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user