Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769493
D2995.id7648.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D2995.id7648.diff
View Options
diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@
[dependencies]
env_logger = "^0.10.0"
lazy_static = "^1.4.0"
-limiting-factor = "0.7.2"
+limiting-factor = "^0.8.0"
log = "^0.4.17"
rocket = "^0.4.11"
rocket_codegen = "^0.4.11"
diff --git a/src/server/requests.rs b/src/server/requests.rs
--- a/src/server/requests.rs
+++ b/src/server/requests.rs
@@ -5,6 +5,7 @@
// License: BSD-2-Clause
// -------------------------------------------------------------
+use limiting_factor::api::guards::RequestBody;
use limiting_factor::api::replies::{ApiJsonResponse, ApiResponse};
use log::{debug, info, warn};
use rocket::State;
@@ -35,16 +36,12 @@
#[post("/init/<site_name>", data = "<context>")]
pub fn init(
site_name: String,
- context: String,
+ context: RequestBody,
config: State<AlkaneConfig>,
) -> ApiJsonResponse<RecipeStatus> {
info!("Deploying {}", &site_name);
- let context = if context.is_empty() {
- None
- } else {
- Some(context)
- };
+ let context = context.into_optional_string();
debug!("Context: {:?}", &context);
match actions::initialize(&site_name, context, &config) {
@@ -60,16 +57,12 @@
#[post("/update/<site_name>", data = "<context>")]
pub fn update(
site_name: String,
- context: String,
+ context: RequestBody,
config: State<AlkaneConfig>,
) -> ApiJsonResponse<RecipeStatus> {
info!("Deploying {}", &site_name);
- let context = if context.is_empty() {
- None
- } else {
- Some(context)
- };
+ let context = context.into_optional_string();
debug!("Context: {:?}", &context);
match actions::update(&site_name, context, &config) {
@@ -85,16 +78,12 @@
#[post("/deploy/<site_name>", data = "<context>")]
pub fn deploy(
site_name: String,
- context: String,
+ context: RequestBody,
config: State<AlkaneConfig>,
) -> ApiJsonResponse<RecipeStatus> {
info!("Deploying {}", &site_name);
- let context = if context.is_empty() {
- None
- } else {
- Some(context)
- };
+ let context = context.into_optional_string();
debug!("Context: {:?}", &context);
match actions::deploy(&site_name, context, &config) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 14:57 (21 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260101
Default Alt Text
D2995.id7648.diff (2 KB)
Attached To
Mode
D2995: Use RequestBody data guard
Attached
Detach File
Event Timeline
Log In to Comment