Skip to content

Commit

Permalink
default onRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
webbdays committed May 10, 2024
1 parent ea41992 commit f7ab336
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/blueprint/operators/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn compile_http(
let on_request = http
.on_request
.clone()
.or(config_module.upstream.on_request.clone());
.or(config_module.upstream.on_request.clone()).or(Some("onRequest".to_string()));
let http_filter = http::HttpFilter { on_request };
if !http.group_by.is_empty() && http.method == Method::GET {
let group_by = Some(GroupBy::new(http.group_by.clone()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source: tests/core/spec.rs
expression: merged
---
schema @server @upstream(onRequest: "onRequest") @link(src: "test.js", type: Script) {
schema @server @upstream @link(src: "test.js", type: Script) {
query: Query
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source: tests/core/spec.rs
expression: merged
---
schema @server @upstream(onRequest: "onRequest") @link(src: "test.js", type: Script) {
schema @server @upstream @link(src: "test.js", type: Script) {
query: Query
}

Expand Down
6 changes: 1 addition & 5 deletions tests/execution/test-js-multiple-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ function onRequest(request) {}
```

```graphql @server
schema
@server
@upstream(onRequest: "onRequest")
@link(type: Script, src: "test1.js")
@link(type: Script, src: "test2.js") {
schema @server @link(type: Script, src: "test1.js") @link(type: Script, src: "test2.js") {
query: Query
}

Expand Down
2 changes: 1 addition & 1 deletion tests/execution/test-js-request-response-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function onRequest({request}) {
```

```graphql @server
schema @server @upstream(onRequest: "onRequest") @link(type: Script, src: "test.js") {
schema @server @link(type: Script, src: "test.js") {
query: Query
}

Expand Down
2 changes: 1 addition & 1 deletion tests/execution/test-js-request-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function onRequest({request}) {
```

```graphql @server
schema @server @upstream(onRequest: "onRequest") @link(type: Script, src: "test.js") {
schema @server @link(type: Script, src: "test.js") {
query: Query
}

Expand Down

0 comments on commit f7ab336

Please sign in to comment.