Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3394098
D6947.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6947.diff
View Options
diff --git a/services/feature-flags/src/service.rs b/services/feature-flags/src/service.rs
--- a/services/feature-flags/src/service.rs
+++ b/services/feature-flags/src/service.rs
@@ -1,10 +1,9 @@
use crate::config::CONFIG;
use crate::constants::{PLATFORM_ANDROID, PLATFORM_IOS};
use crate::database::{DatabaseClient, FeatureConfig, Platform};
-use actix_web::http::header::ContentType;
use actix_web::{web, App, HttpResponse, HttpServer};
use comm_services_lib::database::Error;
-use serde::Deserialize;
+use serde::{Deserialize, Serialize};
use std::collections::HashSet;
pub struct FeatureFlagsService {
@@ -49,10 +48,10 @@
.await
{
Ok(features) => {
- let response_body = features.into_iter().collect::<Vec<_>>().join(",");
- HttpResponse::Ok()
- .content_type(ContentType::plaintext())
- .body(response_body)
+ let response_body = FeaturesResponse {
+ enabled_features: features,
+ };
+ HttpResponse::Ok().json(response_body)
}
_ => HttpResponse::InternalServerError().finish(),
}
@@ -103,6 +102,11 @@
}
}
+#[derive(Serialize)]
+struct FeaturesResponse {
+ enabled_features: HashSet<String>,
+}
+
#[derive(Deserialize, Debug)]
struct FeatureQuery {
code_version: i32,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 5:28 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605697
Default Alt Text
D6947.diff (1 KB)
Attached To
Mode
D6947: [services][feature-flags] Serve application/json instead of text/plain
Attached
Detach File
Event Timeline
Log In to Comment