Skip to content

Commit

Permalink
feat: multiple onRequest handlers (#1863)
Browse files Browse the repository at this point in the history
Co-authored-by: Tushar Mathur <[email protected]>
Co-authored-by: amit <[email protected]>
  • Loading branch information
3 people authored Jun 7, 2024
1 parent bdd16df commit 09809bb
Show file tree
Hide file tree
Showing 35 changed files with 767 additions and 598 deletions.
2 changes: 1 addition & 1 deletion benches/data_loader_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub fn benchmark_data_loader(c: &mut Criterion) {
file: Arc::new(File {}),
cache: Arc::new(Cache {}),
extensions: Arc::new(vec![]),
http_worker: None,
cmd_worker: None,
worker: None,
};
let loader = HttpDataLoader::new(rt, None, false);
Expand Down
2 changes: 1 addition & 1 deletion benches/impl_path_string_for_evaluation_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn request_context() -> RequestContext {
file: Arc::new(File {}),
cache: Arc::new(InMemoryCache::new()),
extensions: Arc::new(vec![]),
http_worker: None,
cmd_worker: None,
worker: None,
};
RequestContext::new(runtime)
Expand Down
2 changes: 1 addition & 1 deletion examples/jsonplaceholder_script.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema
@server(port: 8000, hostname: "0.0.0.0")
@upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42)
@upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, onRequest: "onRequest")
@link(type: Script, src: "scripts/echo.js") {
query: Query
}
Expand Down
14 changes: 14 additions & 0 deletions generated/.tailcallrc.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ directive @http(
"""
method: Method
"""
onRequest field in @http directive gives the ability to specify the request interception
handler.
"""
onRequest: String
"""
Schema of the output of the API call. It is automatically inferred in most cases.
"""
output: Schema
Expand Down Expand Up @@ -382,6 +387,10 @@ directive @upstream(
"""
keepAliveWhileIdle: Boolean
"""
onRequest field gives the ability to specify the global request interception handler.
"""
onRequest: String
"""
The time in seconds that the connection pool will wait before closing idle connections.
"""
poolIdleTimeout: Int
Expand Down Expand Up @@ -646,6 +655,11 @@ input Http {
"""
method: Method
"""
onRequest field in @http directive gives the ability to specify the request interception
handler.
"""
onRequest: String
"""
Schema of the output of the API call. It is automatically inferred in most cases.
"""
output: Schema
Expand Down
14 changes: 14 additions & 0 deletions generated/.tailcallrc.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,13 @@
}
]
},
"onRequest": {
"description": "onRequest field in @http directive gives the ability to specify the request interception handler.",
"type": [
"string",
"null"
]
},
"output": {
"description": "Schema of the output of the API call. It is automatically inferred in most cases.",
"anyOf": [
Expand Down Expand Up @@ -1399,6 +1406,13 @@
"null"
]
},
"onRequest": {
"description": "onRequest field gives the ability to specify the global request interception handler.",
"type": [
"string",
"null"
]
},
"poolIdleTimeout": {
"description": "The time in seconds that the connection pool will wait before closing idle connections.",
"type": [
Expand Down
Loading

0 comments on commit 09809bb

Please sign in to comment.