Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multiple onRequest handlers #1863

Merged
merged 26 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading