Skip to content
This repository was archived by the owner on Jun 9, 2022. It is now read-only.

Commit d8000c9

Browse files
committed
Update src/main.rs
- Add end() to path for exact filter match for path.
1 parent 8298080 commit d8000c9

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/main.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ async fn main() -> anyhow::Result<()> {
6161
.allow_any_origin()
6262
.build();
6363
let log = warp::log("api::request");
64-
let status = warp::get().and(warp::path("status")).map(|| format!("OK"));
64+
let status = warp::get()
65+
.and(warp::path("status"))
66+
.and(warp::path::end())
67+
.map(|| format!("OK"));
6568
let auth = warp::post()
6669
.and(warp::path("auth"))
70+
.and(warp::path::end())
6771
.and(env.clone())
6872
.and(warp::body::json())
6973
.and(warp::addr::remote())
@@ -118,9 +122,11 @@ async fn main() -> anyhow::Result<()> {
118122

119123
let query = warp::post()
120124
.and(warp::path("query"))
125+
.and(warp::path::end())
121126
.and(make_graphql_filter(graphql::schema(), context.clone()));
122127

123128
let subscriptions = warp::path("subscriptions")
129+
.and(warp::path::end())
124130
.and(warp::ws())
125131
.and(context)
126132
.and(warp::any().map(move || Arc::clone(&coordinator)))
@@ -137,10 +143,12 @@ async fn main() -> anyhow::Result<()> {
137143
})
138144
.map(|reply| warp::reply::with_header(reply, "Sec-WebSocket-Protocol", "graphql-ws"));
139145

140-
let playground = warp::path("playground").and(playground_filter(
141-
"/graphql/query",
142-
Some("/graphql/subscriptions"),
143-
));
146+
let playground = warp::path("playground")
147+
.and(warp::path::end())
148+
.and(playground_filter(
149+
"/graphql/query",
150+
Some("/graphql/subscriptions"),
151+
));
144152

145153
warp::path("graphql").and(query.or(subscriptions).or(playground))
146154
};

0 commit comments

Comments
 (0)