Page MenuHomePhabricator

D6947.diff
No OneTemporary

D6947.diff

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

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)

Event Timeline