Page MenuHomeDevCentral

D2995.diff
No OneTemporary

D2995.diff

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

Mime Type
text/plain
Expires
Sun, Nov 24, 11:39 (20 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260101
Default Alt Text
D2995.diff (2 KB)

Event Timeline