Skip to content

Commit

Permalink
Add CORS policy
Browse files Browse the repository at this point in the history
  • Loading branch information
feliwir committed Feb 27, 2024
1 parent cd3291e commit 9db7085
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/simple_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
actix-cors = "0.7.0"
actix-web = "4.5.1"
dicom = "0.6.3"
dicom-object = "0.6.3"
Expand Down
7 changes: 5 additions & 2 deletions examples/simple_server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{env, fs};

use actix_cors::Cors;
use actix_web::{middleware, web, App, HttpServer};
use dicom::{
core::{DataElement, PrimitiveValue},
Expand All @@ -12,6 +11,7 @@ use dicomweb_server::{
INSTANCE_TAGS, SERIES_TAGS, STUDY_TAGS,
};
use itertools::Itertools;
use std::{env, fs};
use walkdir::WalkDir;

const DATA_DIR: &str = "data";
Expand Down Expand Up @@ -352,7 +352,10 @@ async fn main() -> std::io::Result<()> {
env_logger::init();

HttpServer::new(|| {
let cors = Cors::default().allow_any_origin();

App::new()
.wrap(cors)
.wrap(middleware::Compress::default())
.app_data(web::Data::new(dicomweb_server::DicomWebServer {
search_instances: search_instances,
Expand Down
1 change: 0 additions & 1 deletion server/src/filter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use dicom_object::InMemDicomObject;

use crate::QidoStudyQuery;
Expand Down
1 change: 0 additions & 1 deletion server/src/multipart/builder.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use std::io::{self, Read, Write};
use uuid::Uuid;

Expand Down
4 changes: 1 addition & 3 deletions server/src/wado.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::{
io::{Write},
};
use std::io::Write;

use actix_web::{get, web, HttpResponse, Responder};

Expand Down

0 comments on commit 9db7085

Please sign in to comment.