Skip to content

Commit

Permalink
Fix paginated response headers (#137)
Browse files Browse the repository at this point in the history
Ensures paginated responses content type is set to application/json.

Signed-off-by: Rémy Greinhofer <[email protected]>
  • Loading branch information
rgreinho authored Aug 14, 2024
1 parent 32029df commit d17fbfc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lambdas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use effortless::{
error::{APIError, APIErrors},
fragment::BnaRequestExt,
};
use lambda_http::{Body, Error, Request, Response};
use lambda_http::{http::header, Body, Error, Request, Response};
use sea_orm::{Database, DatabaseConnection, DbErr};
use serde_json::Value;
use std::env;
Expand Down Expand Up @@ -142,6 +142,7 @@ pub fn build_paginated_response(
.header("x-prev-page", nav.prev())
.header("x-total", total_items)
.header("x-total-pages", nav.last())
.header(header::CONTENT_TYPE, "application/json")
.body(body.to_string().into())
.map_err(Box::new)?)
}
Expand Down

0 comments on commit d17fbfc

Please sign in to comment.