summaryrefslogtreecommitdiffstats
path: root/tests/parse_es_requests.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-03-29 19:32:54 -0700
committerBryan Newbold <bnewbold@archive.org>2021-03-29 19:33:19 -0700
commitb0f259eff213214d08346cfb4789439d526a9790 (patch)
treeefc3ff454b063f69e7e6e77a9a6e609fa15579e3 /tests/parse_es_requests.rs
parent3212ce9a263083377fb40778e8f49a86ffea2047 (diff)
downloades-public-proxy-b0f259eff213214d08346cfb4789439d526a9790.tar.gz
es-public-proxy-b0f259eff213214d08346cfb4789439d526a9790.zip
in safe-mode, allow index API methods without trailing slash
If we allowed this in `unsafe_all_indices`, then all top-level API methods would be available, which we don't want.
Diffstat (limited to 'tests/parse_es_requests.rs')
-rw-r--r--tests/parse_es_requests.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/parse_es_requests.rs b/tests/parse_es_requests.rs
index 53a9889..a654ca3 100644
--- a/tests/parse_es_requests.rs
+++ b/tests/parse_es_requests.rs
@@ -105,6 +105,23 @@ fn filter_other_requests() {
}
#[test]
+fn filter_other_safe_requests() {
+ let file_paths = fs::read_dir("tests/files/other_safe").unwrap();
+ let config: ProxyConfig = toml::from_str(include_str!("files/safe_config.toml")).unwrap();
+ let rt = tokio::runtime::Runtime::new().unwrap();
+
+ for path in file_paths {
+ let path = path.unwrap().path();
+ if path.extension() != Some(OsStr::new("txt")) {
+ continue;
+ }
+ println!(" filtering: {}", path.display());
+ let req = common::load_request(&path);
+ rt.block_on(filter_request(req, &config)).unwrap();
+ }
+}
+
+#[test]
fn filter_failures() {
let file_paths = fs::read_dir("tests/files/search_fail").unwrap();
let mut config = ProxyConfig::default();