Skip to content

Commit 4968b89

Browse files
committed
Updated response on the font-files route when error occur
1 parent 302ca04 commit 4968b89

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/routes/get_files.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ fn handler(_: Request<Vec<u8>>, mut response: ResponseBuilder, config: &Config)
88
match Fonts::new(&config.directories) {
99
Err(err) => {
1010
warn!("Cannot get fonts, ERROR: {}", err);
11-
response.status(StatusCode::INTERNAL_SERVER_ERROR);
12-
Ok(response.body("Failed get fonts".as_bytes().to_vec())?)
11+
Ok(
12+
response
13+
.header("Access-Control-Allow-Origin", "https://www.figma.com")
14+
.header("Content-Type", "text/plain")
15+
.status(StatusCode::INTERNAL_SERVER_ERROR)
16+
.body("Failed get fonts".as_bytes().to_vec())?,
17+
)
1318
}
1419
Ok(fonts) => {
1520
let mut json = "{\"version\": 4,\"fontFiles\":".to_string();

0 commit comments

Comments
 (0)