diff options
| author | Fuwn <[email protected]> | 2022-03-08 04:39:55 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-08 04:39:55 +0000 |
| commit | 4fd3e42f8c894d33d77bf9060fbcac02e4eed711 (patch) | |
| tree | 250daecc2eef6c4934af6aa1a8bc2a8ba92c7029 /src/utils.rs | |
| parent | fix(routes): index version (diff) | |
| download | api-worker-4fd3e42f8c894d33d77bf9060fbcac02e4eed711.tar.xz api-worker-4fd3e42f8c894d33d77bf9060fbcac02e4eed711.zip | |
fix: cors
Diffstat (limited to 'src/utils.rs')
| -rw-r--r-- | src/utils.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs index fd2ba5b..d1083a9 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -16,6 +16,8 @@ // Copyright (C) 2022-2022 Fuwn <[email protected]> // SPDX-License-Identifier: GPL-3.0-only +use worker::Cors; + use crate::{constants, structures::GitHubAPIResponse}; /// # Errors @@ -87,3 +89,9 @@ pub async fn filter_images_by_language(language: &str) -> Vec<String> { images } + +pub fn cors() -> Cors { + Cors::default() + .with_origins(vec!["*"]) + .with_methods(vec![worker::Method::Get]) +} |